我已经成功找到并执行了代码,为工作簿中的每个工作表创建了一个超链接列表。但是,我有隐藏的工作表,不希望隐藏的工作表包含在超链接列表中。适用于所有工作表的代码是。
是否有一种简单的方法可以从生成的超链接列表中删除隐藏的工作表?
ActiveSheet.Range("P4").Select
Dim sh As Worksheet
Dim cell As Range
For Each sh In ActiveWorkbook.Worksheets
If ActiveSheet.Name <> sh.Name Then
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'" & sh.Name & "'" & "!A1", TextToDisplay:=sh.Name
ActiveCell.Offset(1, 0).Select
End If
Next sh
答案 0 :(得分:0)
ActiveSheet.Range("P4").Select
Dim sh As Worksheet
Dim cell As Range
For Each sh In ActiveWorkbook.Worksheets
If sh.Visible = xlSheetVisible Then
If ActiveSheet.Name <> sh.Name Then
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'" & sh.Name & "'" & "!A1", TextToDisplay:=sh.Name
ActiveCell.Offset(1, 0).Select
End If
End If
Next sh