If you have an Excel workbook that has hundreds of worksheets, and now you want to get a list of all the worksheet names, you can refer to this article. Here we will share 3 simple methods with you.
Sometimes, you may be required to generate a list of all worksheet names in an Excel workbook. If there are only few sheets, you can just use the Method 1 to list the sheet names manually. However, in the case that the Excel workbook contains a great number of worksheets, you had better use the latter 2 methods, which are much more efficient.
Method 1: Get List Manually
- First off, open the specific Excel workbook.
- Then, double click on a sheet’s name in sheet list at the bottom.
- Next, press “Ctrl + C” to copy the name.
- Later, create a text file.
- Then, press “Ctrl + V” to paste the sheet name.
- Now, in this way, you can copy each sheet’s name to the text file one by one.
Method 2: List with Formula
- At the outset, turn to “Formulas” tab and click the “Name Manager” button.
- Next, in popup window, click “New”.
- In the subsequent dialog box, enter “ListSheets” in the “Name” field.
- Later, in the “Refers to” field, input the following formula:
=REPLACE(GET.WORKBOOK(1),1,FIND("]",GET.WORKBOOK(1)),"")
- After that, click “OK” and “Close” to save this formula.
- Next, create a new worksheet in the current workbook.
- Then, enter “1” in Cell A1 and “2” in Cell A2.
- Afterwards, select the two cells and drag them down to input 2,3,4,5, etc. in Column A.
- Later, put the following formula in Cell B1.
=INDEX(ListSheets,A1)
- At once, the first sheet name will be input in Cell B1.
- Finally, just copy the formula down until you see the “#REF!” error.
Method 3: List via Excel VBA
- For a start, trigger Excel VBA editor according to “How to Run VBA Code in Your Excel“.
- Then, put the following code into a module or project.
Sub ListSheetNamesInNewWorkbook() Dim objNewWorkbook As Workbook Dim objNewWorksheet As Worksheet Set objNewWorkbook = Excel.Application.Workbooks.Add Set objNewWorksheet = objNewWorkbook.Sheets(1) For i = 1 To ThisWorkbook.Sheets.Count objNewWorksheet.Cells(i, 1) = i objNewWorksheet.Cells(i, 2) = ThisWorkbook.Sheets(i).Name Next i With objNewWorksheet .Rows(1).Insert .Cells(1, 1) = "INDEX" .Cells(1, 1).Font.Bold = True .Cells(1, 2) = "NAME" .Cells(1, 2).Font.Bold = True .Columns("A:B").AutoFit End With End Sub
- Later, press “F5” to run this macro right now.
- At once, a new Excel workbook will show up, in which you can see the list of worksheet names of the source Excel workbook.
Comparison
Advantages | Disadvantages | |
Method 1 | Easy to operate | Too troublesome if there are a lot of worksheets |
Method 2 | Easy to operate | Demands you to type the index first |
Method 3 | Quick and convenient | Users should beware of the external malicious macros |
Easy even for VBA newbies |
Excel Gets Corrupted
MS Excel is known to crash from time to time, thereby damaging the current files on saving. Therefore, it’s highly recommended to get hold of an external powerful Excel repair tool, such as DataNumen Outlook Repair. It’s because that self-recovery feature in Excel is proven to fail frequently.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql fix and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply