EXCEL添加链接
2019獨角獸企業重金招聘Python工程師標準>>>
'添加鏈接 Sub Add_Hyperlink_by_CC() Dim Dic As Object Dim i, m Dim arr Dim Sk$ Dim Sht$ Dim ShName$ Dim ws As Worksheet Dim TmpTxt$ '----------------------------------------------------------- arr = Sheets("CC").UsedRange Set Dic = CreateObject("Scripting.Dictionary") For i = 2 To UBound(arr)Sk = arr(i, 2)If arr(i, 18) = "X" Then '需要操作工作表標志Dic(Sk) = ""End If Next i '----------------------------------------------------------- Sht = "Summary 2018" With Sheets(Sht)For m = 2 To .Cells(65536, 1).End(xlUp).RowTmpTxt = .Cells(m, 1) '原始文本If Dic.Exists(TmpTxt) Then.Cells(m, 1).Hyperlinks.DeleteShName = TmpTxt 'Key'添加工作表鏈接'名稱需加' 'For Each ws In WorksheetsIf ws.Name = ShName ThenSheets(Sht).Hyperlinks.Add Anchor:=Sheets(Sht).Cells(m, 1), Address:="", SubAddress:= _"'" & ws.Name & "'" & "!A1"'添加返回鏈接With ws.Hyperlinks.Add Anchor:=.Cells(1, 1), Address:="", SubAddress:="'Summary 2018'!A" & mEnd WithExit ForEnd IfNextEnd IfNext m End With MsgBox ("Done") End Sub?
轉載于:https://my.oschina.net/tedzheng/blog/1580227
總結
- 上一篇: HTML基础-第二讲
- 下一篇: office频繁显示停止工作