Excel VBA - Hyperlink

Brass Contributor

Hello i would like please to add hyperlink to IDs column using VBA code,

Basically the macro would go to IDs column and add this Link for every ID cell until last one.


here is the exemple of the first hyperlink to add


%2014897%20 &tab=Summary


Note : the ID number "14897" is the reference of the page in the website 

Here is the file for testing

thank you forward for your help :)

2 Replies


Try this:

Sub AddHyperlinks()
    Dim rng As Range
    For Each rng In Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
        ActiveSheet.Hyperlinks.Add _
            Anchor:=rng, _
            Address:="https://referential.fortesting.com/referential/Pages/" & _
                "Components/Component.aspx?id=" & rng.Value & "&tab=Summary"
    Next rng
End Sub
It's working thank you so much :)