Hello All,
I have the following code that creates a Dynamic list of worksheets in my workbook. It works "Okay" but needs some finesse.
In the code is This Line
It Excludes The Table of Contents page from the list. This Works Fine.
I would also like it to exclude any worksheet that has the property
. Visible = xlSheetVeryHidden
This is what I tried
But it didn't work. No errors, just didn't work. Sheet29 is omitted but any sheet that is xlSheetVeryHidden still makes the list.
Any help would be greatly appreciated! Here is the entire code
Thank you in advance,
Jim
I have the following code that creates a Dynamic list of worksheets in my workbook. It works "Okay" but needs some finesse.
In the code is This Line
VBA Code:
If sht.CodeName <> "Sheet29" Then
I would also like it to exclude any worksheet that has the property
. Visible = xlSheetVeryHidden
This is what I tried
VBA Code:
If sht.CodeName <> "Sheet29" Or sht.Visible = xlSheetVeryHidden Then
Any help would be greatly appreciated! Here is the entire code
VBA Code:
Private Sub Worksheet_Activate()
Dim sht As Worksheet
Dim TOCsht As Worksheet
Dim RowNo As Integer
Set TOCsht = Sheet29
TOCsht.Unprotect Password:="Password"
TOCsht.Cells.Clear
With TOCsht.Cells(1, 1)
.Value = "Index"
.Font.Bold = True
.Font.Size = 20
.HorizontalAlignment = xlCenter
End With
RowNo = 1
For Each sht In ThisWorkbook.Worksheets
If sht.CodeName <> "Sheet29" Or sht.Visible = xlSheetVeryHidden Then
RowNo = RowNo + 1
TOCsht.Cells(RowNo, 1).Hyperlinks.Add _
Anchor:=Cells(RowNo, 1), _
Address:="", SubAddress:="'" & sht.Name & "'!A1", _
ScreenTip:="", _
TextToDisplay:=sht.Name
End If
Next sht
Dim r As Range, c As Range
Set r = Range(Range("A2"), Range("A2").End(xlDown))
For Each c In r
With c.Font
.Size = 12
End With
Next
End Sub
Thank you in advance,
Jim