Creates a hyperlink to each worksheet in the workbook excluding the worksheet containing rgLinks. : Hyperlinks « Excel « VBA / Excel / Access / Word






Creates a hyperlink to each worksheet in the workbook excluding the worksheet containing rgLinks.

 
Sub CreateLinks()
    Dim rgLinks As range
    Set rgLinks = range("C1")
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
        If ws.name <> rgLinks.Parent.name Then
            rgLinks.Hyperlinks.add rgLinks, ThisWorkbook.name, _
                "'" & ws.name & "'!A1", ws.name, ws.name
            Set rgLinks = rgLinks.Offset(1, 0)
        End If
    Next
    Set ws = Nothing
End Sub

 








Related examples in the same category

1.Using the Follow method of the Hyperlink object(user selecting the hyperlink in the Excel application)