View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default list worksheets in a workbook.

then you can use something like one of these:

Sub list_names()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
Worksheets("Sheet1").Range("A" & ws.Index) = ws.Name
Next
End Sub

or

Sub list_names()
Dim i As Long

For i = 1 To Worksheets.Count
Worksheets("sheet1").Range("A" & i).Value = Worksheets(i).Name
Next
End Sub


--


Gary


"mepetey" wrote in message
...
Thanks for the fast response. I would like to insert them as a list in a
separate worksheet, and use as a validation list.

.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
you don't say where you want to list them, this will display them in the
immediate window
in the vb editor, do a control-G. if you want them in a specific place, post
back


Sub list_names()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next
End Sub

--


Gary


"mepetey" wrote in message
...
I have a workbook that has upwards of 50 worksheets. Is there a simple way of
generating a list of those worksheets names? I don't fancy having to do it
manually?

TIA