Macro to Create the list of Worksheets present in an Excel Workbook


Create a list of Worksheets present in a Workbook


Sub ListEverySheet()
Dim XNC As Worksheet
Dim X As Integer
X = 0
Sheets("List of WorkSheets").Select
Range("A2").Select
For Each XNC In ThisWorkbook.Sheets
ActiveCell.Offset(X, 0).Value = XNC.Name
X = X + 1
Next
End Sub

Create a list of Worksheet with Properties


Sub ListEverySheetWithProperties()
Dim XNC As Worksheet
Dim X As Integer
X = 0
Sheets("List of WorkSheets").Select
Range("A2").Select
For Each XNC In ThisWorkbook.Sheets
ActiveCell.Offset(X, 0).Value = XNC.Name
If XNC.Visible = True Then
ActiveCell.Offset(X, 1).Value = "Visible"
ElseIf XNC.Visible = xlSheetHidden Then
ActiveCell.Offset(X, 1).Value = "Hidden"
ElseIf XNC.Visible = xlSheetVeryHidden Then
ActiveCell.Offset(X, 1).Value = "Very Hidden"
End If
X = X + 1
Next
End Sub

Count the total number of Worksheets in a Workbook


Sub CountSheets()
MsgBox Application.Sheets.Count
End Sub

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.