How do I create a list (Word) of the names on Excel worksheet tabs

P

PT

I need to create a list in Word of the names on (20) Excel worksheet tabs. I
can find the list, but I cannot copy and paste.
 
J

Joel

Here is code that will make the list on Sheet1 starting at cell A1. You
probably don't want to remove sheet1 from the list

Sub GetWorksheetNames()

RowCount = 1

For Each MyWorksheet In ThisWorkbook.Worksheets

Worksheets("Sheet1").Range("A1").Offset(rowOffset:=RowCount,
columnOffset:=0) = MyWorksheet.Name

RowCount = RowCount + 1
Next MyWorksheet

End Sub
 
G

Gord Dibben

I would first put the list into a new worksheet then copy the list to Word.

Private Sub ListSheets()
'list of sheet names starting at A1
'first insert a new worksheet
Dim rng As Range
Dim i As Integer
Set rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub


Gord Dibben MS Excel MVP
 
Top