Hyperlinks

excel_training_wheels

Board Regular
Joined
Aug 25, 2005
Messages
193
Hi--

I have a workbook with hyperlinks included. I would like to VLOOKUP and have the underlying URL returned, rather than the hyperlink. Is there a way to do that?

--OR--

Is there a way to convert the entire column of hyperlinks to just have the URL, and then my VLOOKUP will be fine.

In otherwords, I want to see http://...... instead of E09887.htm when the lookup is complete.

Please help!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
excel_training_wheels said:
Is there a way to convert the entire column of hyperlinks to just have the URL, and then my VLOOKUP will be fine.

Assuming the links are in column A, this should work. This will change the text in the cell to display the address of the link (if there is one). This will leave the cell linked, as well.:

Code:
Sub test()
Dim LastRow As Long, i As Long

LastRow = Range("A65536").End(xlUp).Row

For i = 1 To LastRow
    On Error Resume Next
    Cells(i, 1).Value = Cells(i, 1).Hyperlinks(1).Address
Next i

End Sub
 
Upvote 0
Thanks Kristy.

I am pretty new to Excel, and and not sure what to do with the code you provided. Where do I paste that in excel? In the column adjacent to the links?
 
Upvote 0
Ah, sorry. No, it is not a formula, it is a macro. You need to put it in a module.

Go to Tools\Macro\Visual Basic Editor (or press Alt+F11) to open said Visual Basic Editor (VBE).

From there, go to the Insert menu and select "Module." Paste the code into the screen that appears. You can then close the VBE and go back to Excel where you can run the macro from Tools\Macro\Macros. Selecting "test" (the current name of the macro) from the list of macros and click "run" to use it.

You should see the links in column A change while the code is running.
 
Upvote 0
WOW--- Awesome!

What would code would I change if the links were in column H, or M instead of A for example?

(Last question, promise!)

Thanks sooooooooo much Kristy!
 
Upvote 0
Nothing too major:

Where this statement references A65536
Code:
LastRow = Range("A65536").End(xlUp).Row
just change the A to whatever column you want/need.

Then where you see
Code:
Cells(i, 1)
in the code, change the 1 to the same column letter. So if you used H65536, you would change this to Cells(i,"H")
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

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