|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
老师。我想在除了“目录”以外的工作表建立超级链接返回“目录”,请问如何解决,谢谢。
Sub 建立连接()
Dim i%, j%
Dim d As Object
Set d = CreateObject("scripting.dictionary")
For i = 1 To Sheets.Count
If Not d.Exists("目录") Then
d(Sheets(i).Name) = ""
End If
Next
If Not d.Exists("目录") Then
Sheets.Add after:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "目录"
End If
With Sheets("目录").Cells.ClearContents
End With
Set SH0 = Worksheets("目录")
For Each wsheet In Worksheets
If wsheet.Name <> SH0.Name Then
j = j + 1
SH0.Cells(j, 1).Hyperlinks.Add Anchor:=SH0.Cells(j, 1), _
Address:="", SubAddress:="" & wsheet.Name & "!A1", _
ScreenTip:=wsheet.Name, _
TextToDisplay:=wsheet.Name
End If
Next wsheet
For Each wsheet In Worksheets
If wsheet.Name <> SH0.Name Then
With wsheet
.Cells(1, 10) = "OK"
.Cells(3, 1).Hyperlinks.Add Anchor:=Cells(3, 1), _
Address:="", SubAddress:="" & 目录 & "!A1", _
ScreenTip:="", _
TextToDisplay:=""
End With
End If
Next wsheet
With Sheets("目录")
.UsedRange.CurrentRegion.Borders.Weight = xlThin
.UsedRange.HorizontalAlignment = xlCenter
End With
End Sub
|
|