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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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
 

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

Back
Top