|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
excel批量编辑工作表链接问题
Sub 返回目录()
Dim n As Integer, i As Integer
Dim rng As Range
n = Worksheets.Count
For i = 1 To n
Worksheets(i).Activate
If Cells(1, 1) = "返回目录" Then
Rows("1:1").Select '提示错误,怎么回事?!
Selection.Delete Shift:=xlUp
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(1, 1) = "返回目录"
Range("A1").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'目录(返回未完)'!A1", TextToDisplay:="返回目录"
Else
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(1, 1) = "返回目录"
Range("A1").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'目录(返回未完)'!A1", TextToDisplay:="返回目录"
End If
Next
End Sub
|
-
有些工作表名,似乎有特殊符号的话,表名在编辑超链接界面中会加引号,造成使用VBA批量编辑链接引用失效, ...
-
|