Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add range value to link in vba

i would like to add range value to my link but it is doesn’t work some one can help how can i add range value to the link please?
thanks a lot

    Dim iLink
    Dim myUrl
    Dim Number
    
    i = 7
    Number= Range("D" & i).Value
    myUrl = "https://www.google.com/Number"

    While Range("D" & i).Value <> ""
    iLink = myUrl & Range("D" & i).Value

    ActiveSheet.Hyperlinks.Add _
    Anchor:=Range("D" & i).Offset(, 1), _
    Address:=iLink
    i = i + 1
    Wend

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can do it like this

myUrl = "https://www.google.com/" & Number

Because you enclosed your variable ‘Number’ inside double quotes, vba counted it as a string, not a variable.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading