• Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us

No products in the cart.

  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us

No products in the cart.

  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us

No products in the cart.

  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us
Excel

How to get a list of sheets in an Excel file

0 Comments

Getting a list of the sheet names in an Excel file can make it more convenient to check and manage the sheets. If your file has only a few sheets, then there may not be many issues. However, when the number of sheets increases, keeping track of the data in the sheets becomes essential. Creating a table of contents for your Excel file is a great way to start, and getting a list of the sheet names is the first step. Follow the steps below to learn how to get a list of sheets in an Excel file.

1. How to get the name of the current sheet

To get the name of the current sheet, you only need to enter the following formula into the cell where you want the name of the sheet:

=RIGHT(CELL("filename");LEN(CELL("filename"))-FIND("]";CELL("filename")))

How to get a list of sheets in an Excel file

How to get a list of sheets in an Excel file

2. How to get a list of sheets in an Excel file

To get a list of the sheets in an Excel file, first select the Developer tab on the ribbon. Then select Visual Basic. Alternatively, you can use the keyboard shortcut Alt + F11 to open the VBA window.
The VBA window will appear.

How to get a list of sheets in an Excel file

How to get a list of sheets in an Excel file

 

Select Insert => Module.

How to get a list of sheets in an Excel file

How to get a list of sheets in an Excel file

Then copy the code below into the Module dialog box.

Private Sub CreateTableOfContents()
Dim wsSheet As Worksheet
Dim ws As Worksheet
Dim Counter As Long

On Error Resume Next
Set wsSheet = Sheets("Mucluc")
'Kiem tra su ton tai cua Sheet
On Error GoTo 0
If wsSheet Is Nothing Then
'Neu chua co thi them vao vi tri dau tien cua Workbook
Set wsSheet = ActiveWorkbook.Sheets.Add(Before:=Worksheets(1))
wsSheet.Name = "Mucluc"
End If

With wsSheet
.Cells(2, 1) = "DANH SACH CAC SHEET"
.Cells(2, 1).Name = "Index"
.Cells(4, 1).Value = "STT"
.Cells(4, 2).Value = "Ten Sheet"
End With

'Merge Cell
With Range("A2:B2")
.Merge
.HorizontalAlignment = xlCenter
.Font.Bold = True
End With

'Set ColumnWidth
With Columns("A:A")
.ColumnWidth = 8
.HorizontalAlignment = xlCenter
End With

With Range("A4")
.HorizontalAlignment = xlCenter
.Font.Bold = True
End With

Columns("B:B").ColumnWidth = 30
With Range("B4")
.HorizontalAlignment = xlCenter
.Font.Bold = True
End With

Counter = 1
For Each ws In Worksheets
If ws.Name <> wsSheet.Name Then
'Gan gia tri cot thu tu
wsSheet.Cells(Counter + 4, 1).Value = Counter
'Tao lien ket
wsSheet.Hyperlinks.Add Anchor:=wsSheet.Cells(Counter + 4, 2), _
Address:="", _
SubAddress:=ws.Name & "!A1", _
ScreenTip:=ws.Name, _
TextToDisplay:=ws.Name
'Them nut Quay ve Sheet Muc luc tai moi Sheet
With ws
.Hyperlinks.Add Anchor:=.Range("H1"), Address:="", SubAddress:="Index", TextToDisplay:="Quay ve"
End With
Counter = Counter + 1
End If
Next ws
Set xlSheet = Nothing
End Sub

Then click on the Run icon on the toolbar to run the code.

How to get a list of sheets in an Excel file

How to get a list of sheets in an Excel file

By doing so, a new Table of Contents sheet will automatically be created, and the list of sheets in the file will be displayed there. You only need to click on any sheet, and the worksheet will be easily switched to that sheet.

How to get a list of sheets in an Excel file

How to get a list of sheets in an Excel file

 

In conclusion, this article has shown you how to get a list of sheets in an Excel file. We hope that this article will be useful for you in your work. Good luck!

Rate this post
33
286 Views
Adjust spacing in Word to align textPrevAdjust spacing in Word to align textMarch 9, 2023
Tips for Calculating Debit and Credit Balances for Accounting Accounts in ExcelMarch 9, 2023Tips for Calculating Debit and Credit Balances for Accounting Accounts in ExcelNext

Leave a Reply Cancel reply

You must be logged in to post a comment.

Buy Windows 11 Professional MS Products CD Key
Buy Office 2021 Professional Plus Key Global For 5 PC
Top rated products
  • Kaspersky Internet Security 2021 1 year 5 devices key Global Kaspersky Internet Security 2021 1 year 5 devices key Global
    Rated 5.00 out of 5
    $45.00
  • Windows Server 2022 Datacenter Key Global Windows Server 2022 Datacenter Key Global
    Rated 5.00 out of 5
    $7.00
  • Kaspersky Small Office Security 10 PCs + 10 Mobiles + 1 Server 1 Year Kaspersky Small Office Security 10 PCs + 10 Mobiles + 1 Server 1 Year
    Rated 5.00 out of 5
    $164.50
  • Avast Ultimate Suite 2021 1 Year 10 Devices Global Avast Ultimate Suite 2021 1 Year 10 Devices Global
    Rated 5.00 out of 5
    $54.00
  • Windows 11 Pro Key Global Windows 11 Pro Key Global
    Rated 5.00 out of 5
    $6.00
Products
  • Microsoft Visio Standard 2016 Key 1PC Microsoft Visio Standard 2016 Key 1PC $9.00
  • Windows Server2008 R2 Remote Desktop Services device connections (20)cal Windows Server2008 R2 Remote Desktop Services device connections (20)cal $29.00
  • Windows 11 Pro Key Global Windows 11 Pro Key Global
    Rated 5.00 out of 5
    $6.00
  • Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global
    Rated 5.00 out of 5
    $22.00
  • Windows Server 2025 Remote Desktop Services 50 User Connections Windows Server 2025 Remote Desktop Services 50 User Connections $25.00
  • Microsoft Office Home And Business 2016 For Mac Key Global Bind Microsoft Account Microsoft Office Home And Business 2016 For Mac Key Global Bind Microsoft Account
    Rated 4.92 out of 5
    $15.00
  • Windows Server 2012 R2 Standard Key Global Windows Server 2012 R2 Standard Key Global
    Rated 4.78 out of 5
    $15.00
  • AVG Ultimate 2021 with Antivirus + Cleaner, Secure VPN 10 Devices 2 Years AVG Ultimate 2021 with Antivirus + Cleaner, Secure VPN 10 Devices 2 Years
    Rated 5.00 out of 5
    $47.00
  • Avast Ultimate Suite 2021 1 Year 10 Devices Global Avast Ultimate Suite 2021 1 Year 10 Devices Global
    Rated 5.00 out of 5
    $54.00
  • office-professional-2016-international Microsoft Office Professional Plus 2016 Retail CD Key
    Rated 4.92 out of 5
    $13.00
Product categories
  • Anti Virus
  • Microsoft Office
  • Microsoft Project
  • Microsoft Visio
  • Microsoft Visual
  • Microsoft Windows
  • Other Software
  • Uncategorized

Buffcom.net always brings the best digital products and services to you. Specializing in Office Software and online marketing services

BIG SALE 50% IN MAY

Microsoft Office
Microsoft Windows
Anti-Virus
Contact Us

Visit Us:

125 Division St, New York, NY 10002, USA

Mail Us:

buffcom.net@gmail.com

TERMS & CONDITIONS | PAYMENT GUIDE  | SHIPPING POLICY  | REFUND POLICY

Copyright © 2019 buffcom.net  All Rights Reserved.