View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default List of all visible worksheets

Glad to help.

--
Don Guillett
SalesAid Software

"Gert-Jan" wrote in message
.. .
Hi Don,

Thanks a lot, this works fine!

Gert-Jan

"Don Guillett" schreef in bericht
...
Sub listvisiblesheets()
mc = 2
For Each ws In Worksheets
If ws.Visible = True Then
Cells(mc, 2) = ws.Name
mc = mc + 1
End If
Next
End Sub

--
Don Guillett
SalesAid Software

"Gert-Jan" wrote in message
...
Hi,

Can anyone help me with writing a macro that lists all the sheets of of
a workbook to a certain range?

I have this:

Sub test()
Dim NumSheets As Integer
Dim sht As Object
NumSheets = Sheets.Count
For j = 1 To NumSheets
Cells(j + 1, 8) = Sheets(j).Name
Next j
End Sub

But it writes ALL sheetnames, not only the visible.

Thanks in advance, Gert-Jan