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 did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,215,172
Messages
6,123,443
Members
449,100
Latest member
sktz

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