我正在尝试编写一个
的宏ScreenTip
目前我必须为每个细胞做这件事。如何更新工作簿中的每个超链接?
Sub ScreenTip()
On Error Resume Next
ActiveSheet.Hyperlinks.Add Anchor:=Cells(8, 2), Address:="", ScreenTip:=CStr(Cells(8, 2).Value)
ActiveSheet.Hyperlinks.Add Anchor:=Cells(8, 3), Address:="", ScreenTip:=CStr(Cells(8, 3).Value)
ActiveSheet.Hyperlinks.Add Anchor:=Cells(8, 4), Address:="", ScreenTip:=CStr(Cells(8, 4).Value)
ActiveSheet.Hyperlinks.Add Anchor:=Cells(8, 5), Address:="", ScreenTip:=CStr(Cells(8, 5).Value)
ActiveSheet.Hyperlinks.Add Anchor:=Cells(8, 6), Address:="", ScreenTip:=CStr(Cells(8, 6).Value)
`..... etc
End Sub
答案 0 :(得分:1)
这将遍历活动工作表上的所有现有超链接,并设置其ScreenTip属性
Sub Demo()
Dim hl As Hyperlink
For Each hl In ActiveSheet.Hyperlinks
hl.ScreenTip = CStr(hl.Range.Value)
Next
End Sub
答案 1 :(得分:0)
根据你的问题:
Dim hy As Hyperlink
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
For Each hy In ws.Hyperlinks
hy.ScreenTip = CStr(hy.Range.Value2)
Next
Next