• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Get visible sheet names only

Mr.Karr

Member
Hello,

Can anyone please provide code snippet to extract/get visible sheet names only. Below code snippet I use to list worksheet names in column A.

Code:
Sub SheetNames()
    'Columns(1).Insert
    For i = 1 To Sheets.Count
        Cells(i, 1) = Sheets(i).Name
    Next i
End Sub

Many thanks in advance!
 
Code:
Option Explicit

Sub SheetNames1()
Dim i As Integer, ii As Integer: ii = 1
    'Columns(1).Insert
    Cells(1, 1).CurrentRegion.Cells.Clear
     For i = 1 To Sheets.Count
        If Sheets(i).Visible = -1 Then
            Cells(ii, 1) = Sheets(i).Name
            ii = ii + 1
        End If
    Next
End Sub
 
Back
Top