View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JP[_4_] JP[_4_] is offline
external usenet poster
 
Posts: 897
Default Create a list of Sheet names

How about

Sub CreateSheetsList()

Dim wkbk As Excel.Workbook
Dim wksht As Excel.Worksheet
Dim sheetsCount As Long
Dim sheetNames() As Variant
Dim i As Long

Set wkbk = ActiveWorkbook
Set wksht = ActiveSheet

sheetsCount = wkbk.Sheets.Count
ReDim sheetNames(1 To sheetsCount)

For i = 1 To sheetsCount
sheetNames(i) = wkbk.Sheets(i).Name
Next i

wksht.Range(wksht.Range("A1"), wksht.Range("A" & sheetsCount)).Value =
Application.Transpose(sheetNames)

End Sub


--JP

On Sep 30, 12:53*pm, Al wrote:
What would be the vb code to create a list of the sheet names in an existing
sheet?