Get list worksheet names for only visible worksheets in a workbook

J

Juluka

Please could somebody help me with my query:

I am trying to get a list of worksheet names for only the visibl
worksheets in an open workbook
 
N

Norman Harker

Hi Juluka!

See:
Dave McRitchie:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm

You'll have to adapt the code to exclude Hidden worksheets and to
exclude other data in the table of contents that you don't want.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
R

Robert Rosenberg

The following macro lists the visible sheets of the active workbook in a
message box:

Sub VisibleSheets()

Dim sht As Object
Dim szList As String

For Each sht In ActiveWorkbook.Sheets
If sht.Visible = xlSheetVisible Then szList = szList & vbLf &
sht.Name
Next sht

szList = "The following sheets are visible in " & ActiveWorkbook.Name &
":" & vbLf & szList
MsgBox szList, vbInformation, "Visible Sheets"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top