list visible
Posted: Sun May 17, 2020 12:28 pm
Hi Dear
I have a problem with macro to list all visible sheets.
Here's a code from my friend
Sub test()
Dim i As integer
Dim sh As Worksheet
Sheets.add after:=Sheets(Sheets.count)
For Each sh in ThisWorkbook.Worksheets
i=i+1
If sh.Visible=xlSheetVisible Then
Cells(i,1).Value=sh.Name
End if
Next
End Sub
But it is no luck, what is going wrong?
Best wishes,
I have a problem with macro to list all visible sheets.
Here's a code from my friend
Sub test()
Dim i As integer
Dim sh As Worksheet
Sheets.add after:=Sheets(Sheets.count)
For Each sh in ThisWorkbook.Worksheets
i=i+1
If sh.Visible=xlSheetVisible Then
Cells(i,1).Value=sh.Name
End if
Next
End Sub
But it is no luck, what is going wrong?
Best wishes,