How to Create Hyperlinks

3 views
Skip to first unread message

Vibhuti Shrotriya

unread,
May 24, 2016, 12:45:06 AM5/24/16
to Excel VBA Lab - An Excel VBA Macro help Group
Dear Group Members,

I have 5 Sheets named as AG1, AG2, AG3, AG4, AG5.

I want to create Hyperlinks in A Column for all sheet names.

Please help.



Thanks & Regards
Vibhuti S.

 

GENIUS UFO

unread,
May 24, 2016, 11:29:30 AM5/24/16
to Excel VBA Lab - An Excel VBA Macro help Group

Sub CreateLinksToAllSheets()
    Dim sh As Worksheet
    Dim cell As Range
    For Each sh In ActiveWorkbook.Worksheets
        If ActiveSheet.Name <> sh.Name Then
            ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
            "'" & sh.Name & "'" & "!f1", TextToDisplay:=sh.Name
            ActiveCell.Offset(1, 0).Select
        End If
    Next sh
    End Sub




Vibhuti Shrotriya

unread,
May 25, 2016, 2:56:51 AM5/25/16
to Excel VBA Lab - An Excel VBA Macro help Group
Thanks..!

Working perfect for me.
Reply all
Reply to author
Forward
0 new messages