gkisystems
Board Regular
- Joined
- Apr 20, 2012
- Messages
- 76
I have an awesome macro that creates a list of ALL worksheets (both hidden and unhidden) within my workbook on a new tab called "Index" and each worksheet listed is hyperlinked to that tab (goes to cell A1). How do I modify this macro to list in column B on the Index tab next to each sheet name the words "Hidden" or "Visible" to indiciate if the worksheet listed is hidden or visible?
Here is the macro:
Here is the macro:
Code:
Sub IDX()
'Adds a new worksheet
'Inserts all worksheet names on the new sheet
'Creates a hyperlink to cell A1 for all worksheet names.
Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
newsheet.Name = "Index"
Dim ws As Worksheet, i As Integer
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Index" Then
i = i + 1
Sheets("Index").Range("A" & i).Value = ws.Name
Sheets("Index").Hyperlinks.Add Anchor:=Range("A" & i), Address:="", SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name
End If
Next ws
Sheets("Index").Columns("A").AutoFit
End Sub