How do I list out names of Worksheets in Excel file?
Upcoming Power Excel Seminars
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: How do I list out names of Worksheets in Excel file?

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    357
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    357
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thanks! It works great!

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com