VBA code accumulated daily work

 

1, extract hyperlink address

 

 

Function GetURL(rng As Range) As String
    On Error Resume Next
    GetURL = rng.Hyperlinks(1).Address
End Function

 

2, the Table of Contents page to jump to make multi-sheet (for example the code look-up table to go)

(1) for the entire workbook that ThisWorkbook, enter the following code.

Sub hyperlink ()
Dim ct As Long
Sheet5.Rows("2:100000").ClearContents
For ct = 1 To Sheets.Count If Sheets(ct).Name <> "目录" And Sheets(ct).Name <> "代码问题" Then Sheet5.Range("a100000").End(xlUp).Offset(1, 0) = Sheets(ct).Name Sheet5.Hyperlinks.Add Anchor:=Sheet5.Range("a100000").End(xlUp), Address:="", SubAddress:="'" & Sheets(ct).Name & "'!A1" End If Next End Sub

(2) making a macro and assign the appropriate button, clicking refresh.

Sub Macro 1 ()
 '
' Macro 1 Macro
'

'
    Range("A5").Select Selection.Hyperlinks(1).SubAddress = "'0711-0717'!A1" End Sub

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/bigning/p/11844251.html