Vlookup return hyperlink

SuperBaby

New Member
Joined
Apr 17, 2013
Messages
24
Hi,

I would like to have a vba code or formula that can vlookup my Sheet1!A2 value in Sheet2!A:A and return the cell which has hyperlink embedded. The hyperlink is linked to the file path. Can you please help?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Paste this code in a module,

Code:
Function GetHyperLinkAddress(rng As Range) As String
Dim hl As Hyperlink
For Each hl In rng.Parent.Hyperlinks
    If hl.Range.Address = rng.Address Then
        GetHyperLinkAddress = hl.Address
        Exit Function
    End If
Next hl
GetHyperLinkAddress = "Not Found"
End Function

Now goto sheet2 and in cell B2 enter formula as below and drag down.

= GetHyperLinkAddress(A2)

Now in Sheet1 use this formula in cell A2 and drag down

=HYPERLINK(VLOOKUP(A1,Sheet2!A:B,2,0))

HTH
 
Upvote 0

Forum statistics

Threads
1,215,126
Messages
6,123,198
Members
449,090
Latest member
bes000

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