Adding hyperlink in all sheets

shreeram.maroo
2StarLounger
Posts: 181
Joined: 19 Feb 2016, 16:54
Location: Veraval, India

Adding hyperlink in all sheets

Post by shreeram.maroo »

Hi,

I have an excel file which has 100 worksheets.. I need to add hyperlink to "home" worksheet in A1 cell of every worksheet. Can this be done through quickly through VBA ?

Thanks in advance
Shreeram

User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Adding hyperlink in all sheets

Post by StuartR »

Code: Select all

Dim sht As Worksheet
For Each sht In Worksheets
    If sht.Name <> "Sheet1" Then
        sht.Hyperlinks.Add Anchor:=sht.Range("A1"), Address:="", SubAddress:="'Sheet1'!A1", TextToDisplay:="Home"
    End If
Next sht
Replace Sheet1 with the name of your first sheet
StuartR


shreeram.maroo
2StarLounger
Posts: 181
Joined: 19 Feb 2016, 16:54
Location: Veraval, India

Re: Adding hyperlink in all sheets

Post by shreeram.maroo »

Thanks a lot Stuart