How to show cell value and not cell reference in a hyperlink formula

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
723
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I'm having trouble with a hyperlink formula.

When I use the below the formula shows as =HYPERLINK("https://webaddress.com/?query=" & G5,G5), but what I need is the value in G5 to show in the formula and not the cell reference.

VBA Code:
ActiveSheet.Range("AA5") = "=HYPERLINK(""https://webaddress.com/?query="" & G5,G5)"

As an example, the formula bar for AA5 would show =HYPERLINK("https://webaddress.com/?query=" & 525252,525252), if the value in [G5] was 525252.

I tried adding .Value, but that didn't change the output.

Thank you
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You still haven't used my previous suggestion in post #6, it wasn't only to shrink the code, it was to get what you asked for.
 
Upvote 0
You still haven't used my previous suggestion in post #6, it wasn't only to shrink the code, it was to get what you asked for.

Actually, I did try your suggestion and it gives the same result as mine.
 
Upvote 0
Maybe:
VBA Code:
Option Explicit
Sub test()
    ActiveSheet.Range("AA5") = "'=HYPERLINK(""https://webaddress.com/?query=" & Range("G5") & "," & Range("G5") & ")"
End Sub
 
Upvote 0
Or:
VBA Code:
Sub test()
    ActiveSheet.Range("AA5").Hyperlinks.Add Anchor:=ActiveSheet.Range("AA5"), Address:="https://webaddress.com/?query=" & Range("G5") & "," & Range("G5") & ")", TextToDisplay:=CStr(ActiveSheet.Range("G5"))
    '[AA5].Hyperlinks.Add Anchor:=[AA5], Address:="https://webaddress.com/?query=" & [G5] & "," & [G5] & ")", TextToDisplay:=CStr([G5])
End Sub
Elsewise: I give up, what you are asking for isn't clear to me (or can't be done).
 
Upvote 0

Forum statistics

Threads
1,215,593
Messages
6,125,715
Members
449,254
Latest member
Eva146

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