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

  • Thread starter Thread starter Phillips
  • Start date Start date
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
 
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 *
 
Back
Top