Extract Sheet Names

venumkd

New Member
Joined
Feb 4, 2020
Messages
45
Office Version
  1. 2010
Sirs,

I need a method or VBA to extract or list sheet names of a workbook into a worksheet.

The workbook contains around 5000 sheets named not in a particular order. These sheet names are to be extracted / entered or listed to Sheet1 of the workbook in any of the columns preferably in Column A.

Thanks & Regards.

VENU
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try

VBA Code:
Sub List_Worksheets()
  Dim ws As Worksheet
  Dim i As Long
  
  For Each ws In Worksheets
    i = i + 1
    Sheets("Sheet1").Range("A" & i).Value = ws.Name
  Next ws
End Sub
 
Upvote 0
with Power Query
Rich (BB code):
let
    Source = Excel.Workbook(File.Contents("full_path_to_your_file"), null, true),
    TSC = Table.SelectColumns(Table.SelectRows(Source, each ([Kind] = "Sheet")),{"Name"})
in
    TSC
 
Last edited:
Upvote 0
5000 worksheets! Really, 5000 of them? I cannot imagine what your tabs must look like. Anyway, although I haven't tested it on such a huge number of worksheet, I think it should work... you might find my "Neat Go To Sheet" selector to be of some interest. Here is a link to my mini-blog article where I introduced it...

A Neat "Go To Sheet" Selector
.
 
Upvote 0
5000 worksheets! Really, 5000 of them? I cannot imagine what your tabs must look like. Anyway, although I haven't tested it on such a huge number of worksheet, I think it should work... you might find my "Neat Go To Sheet" selector to be of some interest. Here is a link to my mini-blog article where I introduced it...

A Neat "Go To Sheet" Selector
.

Some very nice code Rick. Thank you for sharing, I'll learn a lot from it. Cheers!
 
Upvote 0

Forum statistics

Threads
1,214,402
Messages
6,119,299
Members
448,885
Latest member
LokiSonic

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top