Forum Discussion

MicrosoftNewbie121's avatar
MicrosoftNewbie121
Brass Contributor
Feb 02, 2024

Excel VBA - Hyperlink

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

https://referential.fortesting.com/referential/Pages/Components/Component.aspx?id=

%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 🙂

  • MicrosoftNewbie121 

    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

Resources