Loop through values in a column and get hyperlinks from another sheet using Vlookup

dagda13

Board Regular
Joined
May 18, 2019
Messages
52
Hi,

I'd like to use excel vba to loop through values in a column and get hyperlinks that are associated with each of those values from another sheet using Vlookup and use the original values in the column as the friendly name. Is this possible? I've tried the below code but only get Run-time error '1004': Unable to get the Vlookup property of the WorksheetFunction class. Is there anyway to get this to work?

VBA Code:
Sub Get_Links_From_Hidden_Tab_Using_VLOOKUP_and_Give_It_The_Original_ID_As_Friendly_Name()

        
    For Each xCell In Range("A:A")
    
        Dim x As Variant
        x = xCell.Value

        If xCell.Value <> "" Then
       
                ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=Application.WorksheetFunction.VLookup(x, Worksheets("Hidden").Range("A:O"), 15, 0), TextToDisplay:=xCell.Value
        
        End If
    
    Next xCell

End Sub
 

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.

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

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