Hyperlink with dynamical variable in the “middle” of the link

RaSHkO

New Member
Joined
Mar 23, 2011
Messages
8
Hello all
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I would like to do the following:

Example:

In cell A1 string (AA0987654)
Now I am trying to make the same cell hyperlink AA0987654 where the link in background should looks like http://example=”value of cell A1”additionalarguments

<o:p></o:p>
Is this possible with formula only? The idea behind is just to drag the cell with this formula across the sheet.

<o:p></o:p>
Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I'm not sure it is possible as you can't add formula into the Hyperlink "address box".

You can do it with a loop in VBA though (loop through all your rows in column A):

Code:
Sub test()
    lRow = Range("A1").End(xlDown).Row
    For i = 2 To lRow
        ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, 2), Address:="http://www." & Cells(i, 1).Value & ".com", TextToDisplay:=Cells(i, 1).Value
    Next
End Sub

The above will loop from row 2 to the last populated row, create a hyperlink based on the text in column A of that row and put the hyperlink in column B.
 
Upvote 0
Maybe:
=HYPERLINK("http://example="""&A1&"""additionalarguments")
 
Upvote 0
Maybe:
=HYPERLINK("http://example="""&A1&"""additionalarguments")



Thanks
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I just realize that the loop I am trying to do is impossible with one row function. The reason is that I am referring to the same cell where I am writing the function. It needs to be VBA.
 
Upvote 0
Hi,

If you are referring to the same cell, try:

Code:
Sub test()
    lRow = Range("A1").End(xlDown).Row
    For i = 2 To lRow
        ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, 1), Address:="http://www." & Cells(i, 1).Value & ".com", TextToDisplay:=Cells(i, 1).Value
    Next
End Sub
 
Upvote 0
Hi,

If you are referring to the same cell, try:

Code:
Sub test()
    lRow = Range("A1").End(xlDown).Row
    For i = 2 To lRow
        ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, 1), Address:="http://www." & Cells(i, 1).Value & ".com", TextToDisplay:=Cells(i, 1).Value
    Next
End Sub

I saw it already. It works very good. Just something additional :oops:
What should I edit in order to have this working for multiple columns?
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
thanks
 
Upvote 0
If your data is like this:

Code:
A        B        C        D
link1    link2    link3   link4    
AAA    BBB     CCC    DDD
123     112     333    444

Then:

Code:
Sub test()
    lRow = Range("A1").End(xlDown).Row
    lCol = Range("A1").End(xlToRight).Column
    For j = 1 To lCol
        For i = 2 To lRow
            ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, j), Address:="http://www." & Cells(i, j).Value & ".com", TextToDisplay:=Cells(i, j).Value
        Next
    Next j
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,480
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top