none
Hyperlink Excel RRS feed

  • Question

  • I want to generate multiple hyper links in Excel.

    The code below shows what I mean:

    With Worksheets("Sheet1")
    For i = 2 To 6
     .Hyperlinks.Add Anchor:=Sheet1.Cells(3, i).Address, _
     Address:="", _
     ScreenTip:="Click me!", _
     TextToDisplay:="Test" & i
     Next i
    End With

    I want to have five times a hyper link in a different cell.

    Can someone help me out to complete the code properly?

    Thanks!


    • Edited by YannickB90 Monday, December 2, 2013 1:49 PM
    Monday, December 2, 2013 12:10 PM

Answers

  • Hi,

    This example create HyperLinks in 5 diffrent cells (A1 to A5)

    Sub test()

    Const FullPath As String = "Your Path\File Name.xls"
    Dim i As Long

    For i = 1 To 5
        With ActiveSheet
            .Hyperlinks.Add Anchor:=Cells(i, "a"), _
            Address:=FullPath, _
            TextToDisplay:="Click!"
        End With
    Next i

     


    End Sub


    Guy Zommer

    • Marked as answer by YannickB90 Monday, December 2, 2013 3:00 PM
    Monday, December 2, 2013 2:35 PM