将工作薄中的全部N张工作表都在sheet1中建上链接

'**********************************************************************************
'*   函数名称:AddLnk
'*   功    能:将工作薄中的全部N张工作表都在sheet1中建上链接
'*
'*   入口参数:wsWork As Worksheet(sheet1)
'*   出口参数:无
'*
'*   返 回  值 :无
'************************************************************************************
Sub AddLnk(wsWork As Worksheet)
    Dim Pt As Range
    Dim i As Long
'    Dim wsWork As Worksheet
'    Set wsWork = ThisWorkbook.Sheets("功能主页")
    
    With wsWork
        Set Pt = .Range("A14")
        For i = 2 To ThisWorkbook.Worksheets.Count
            Pt.FormulaR1C1 = Worksheets(i).Name
            .Hyperlinks.Add Anchor:=Pt, Address:="", SubAddress:=(Worksheets(i).Name & "!A1")
            Set Pt = Pt.Offset(1, 0)
        Next i
    End With
End Sub

你可能感兴趣的:(VBA)