Find/replace old hyperlinks with new ones based on lookup table

jpk89

New Member
Joined
Aug 17, 2015
Messages
13
A1 on the current sheet is the description of corresponding value in a table on sheet 1.
Somewhere in the current sheet in column b is an old hyperlink.
I would like to replace the old link with a new one linking back to the cell on sheet1 displaying the value found there.

For example:

the title of the current sheet in A1 might be "rapper's savings account"
the lookup would find the corresponding value "$0.50" from I37 on sheet1.
the hyperlink on the current sheet would link back to I37 and display $0.50

Debugger runs to 'Vlocation = .... '
The Error is "Unable to get the match property of the worksheet function"


Here is my code so far

Sub LinkReplaceB()

Dim RNG As Range
Dim CEL As Range
Dim VReturn As Variant
Dim VLocation As Range


Set RNG = Range("b1:b100")



For Each CEL In RNG

If (CEL.Hyperlinks.Count) > 0 Then

VReturn = Application.VLookup("a1", Sheet1.Range("f10, i300"), 3, False)
VLocation = Application.Address(WorksheetFunction.Match("a1", Range("f10,i300"), 0))

CEL.Hyperlinks.ClearContents

ActiveSheet.Hyperlinks.Add Anchor:=CEL, Address:="", SubAddress:= _
"vlocation", TextToDisplay:="vreturn"


Else


End If


Next CEL


End Sub



Thanks,

J
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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