我找到了这个宏,并想调整它,以便它从特定的工作表开始,而不是贯穿整个工作簿。
Sub CreateLinksToAllSheets()
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
End Sub
答案 0 :(得分:0)
dim sh as Worksheet
dim cell as Range
dim cnt as Integer,idx as integer
cnt=ActiveWorkbook.Worksheets.Count
idx=2 'any specific worksheet you want to start from
for idx=2 to cnt
set sh=ActiveWorkbook.WorkSheets(idx)
'rest of code goes here
next