SHEET NAME List

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
I have a simple lister to put information onto a page

Code:
    Dim I 
    For I = 3 To Sheets.Count
        Cells(I, 24) = Sheets(I).Name
    Next I

I've tried eliminating a number of sheet names, that are usually hidden

Master and Data Page and Times

anyone point me into how I can exclude those from being added
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I think this might work for you:
Code:
Dim I As Integer
For I = 3 To Sheets.Count
    If Sheets(I).Visible = True Then
        Cells(I, 24) = Sheets(I).Name
    End If
Next I
 
Upvote 0
I didn't like the use of usually in "that are usually hidden" so because of that maybe another option is...

Code:
Sub list_sheets_except()
    Dim ShtName, x As Long, i As Long, j As Long, count As Long
    ShtName = Array("Master", "Data Page", "Times")  'ADD SHEET NAMES HERE NOT TO LIST
    x = 3
    For i = 3 To Worksheets.count
        For j = LBound(ShtName) To UBound(ShtName)
            If Worksheets(i).Name = ShtName(j) Then count = 1
        Next j
        If count = 0 Then
            Cells(x, 24).Value = Worksheets(i).Name
            x = x + 1
        End If
        count = 0
    Next i
End Sub
 
Upvote 0
Try this:
Code:
Sub Sheet_Names()
'Modified 1/26/2019 7:55:55 AM  EST
Application.ScreenUpdating = False
Dim i As Long
For i = 1 To Sheets.Count
    If Sheets(i).Visible <> False Then Cells(i, 24).Value = Sheets(i).Name
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,925
Members
449,056
Latest member
denissimo

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