![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
I am trying to list out the names of the worksheets that I have in an excel file. Say my excel file has 15 worksheets, with names A1, A2, A3, ... , A10. I want to create another worksheet (in the same excel file) that has a list of those 10 worksheet names. Is there any way to do this?
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
Insert a worksheet called summary, and, in the VB editor insert a module. Copy and paste this code into the module. It will put the names of the sheets and charts you have in the workbook in column A on the 'Summary' sheet.
Public Sub CountingSheets() Dim x As Integer Dim ws As Object Sheets("Summary").Columns("A:A").Delete Shift:=xlToLeft For Each ws In Sheets x = x + 1 Sheets("Summary").Range("A" & x).Value = ws.Name Next ws End Sub Hope this is OK. [ This Message was edited by: Mudface on 2002-03-01 11:26 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Thanks! It works great!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|