ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   list all worksheets in a workbook w/o manually typing (https://www.excelbanter.com/setting-up-configuration-excel/58223-list-all-worksheets-workbook-w-o-manually-typing.html)

Danielle HR

list all worksheets in a workbook w/o manually typing
 
I want to create a list of all the worksheets in one workbook, "table of
contents". The table of contents for a report - basically listing all
departments (that's what the tabs are)

I know there is an indexing function, but I don't know how to use it for
indexing or listing worksheets.

Paul B

list all worksheets in a workbook w/o manually typing
 
Danielle, here is one way, you might also want to have a look here

http://www.mvps.org/dmcritchie/excel/buildtoc.htm

Sub TOC()
'will add a sheet, name it Worksheet Names
'and list all sheets in the workbook
Dim ws As Worksheet, n As Integer
n = 2
With Worksheets.Add
.Name = "Worksheet Names"
.Move befo=Worksheets(1)
End With
For Each ws In ActiveWorkbook.Worksheets
If ws.Name < "Worksheet Names" Then
Sheets("worksheet Names").Range("a" & n) = ws.Name
n = n + 1
End If
Next
End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Danielle HR" <Danielle HR @discussions.microsoft.com wrote in message
...
I want to create a list of all the worksheets in one workbook, "table of
contents". The table of contents for a report - basically listing all
departments (that's what the tabs are)

I know there is an indexing function, but I don't know how to use it for
indexing or listing worksheets.





All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com