How can I find a worksheets name but using it's index number?

P

Phillips

I want to find out how many worksheets are in a book, and then get a list of
the all. How can I do that?

Thanks
Phil
 
A

A.W.J. Ales

Phil,

Hereby a subroutine which fill the active cell and the cells under it with
the number of worksheets and their names.
NB If you want other sheets (chartsheets etc. ) as well you have to make
some adjustments.

Sub GetNames()
Dim A As Integer, WksName As String
A = ActiveWorkbook.Worksheets.Count
ActiveCell.Value = "Number of worksheets = " & A
For I = 1 To A
ActiveCell.Offset(I, 0).Value = Worksheets(I).Name
Next
End Sub


--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top