HYPERLINK ADDRESSINT - With or Range question...

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,786
Office Version
  1. 2016
Platform
  1. Windows
I manually recorded a hyperlink macro and then modification it to work as seen No. 1 below.

I tried to modify it to work with "With" (as seen in No. 2) but it keeps putting the address in A1?

With is better the 1 or 2?

1. Range("A4").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"'https://wwwxxxxxxxxxxxxxxxxxx", _
TextToDisplay:="LRS Web Site (address is https://wwwxxxxxxxxxxxxxxxxxxxxxxx)"

2. With .[A4]
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"'https://wwwxxxxxxxxxxxxxxxxxxxxxx", _
TextToDisplay:="LRS Web Site (address is https://wwwxxxxxxxxxxxxxxxxxxxx)"
End With
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Problem is the ANCHOR...it is set to "Selection" in both cases. Try this without using the With...

ActiveSheet.Hyperlinks.Add Anchor:=.[A4], Address:= _
"'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxx", _
TextToDisplay:="LRS Web Site (address is https://xxxxxxxxxxxxxxxxxxxx)"


Edited per Tommy's request ~ Von Pookie
 
Upvote 0
TommyGun - worked perfectly and please see PM...
 
Upvote 0

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

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