Brad Lucas

A blog mostly about programming
August 3, 2017

Get Hyperlink Value From An Excel Cell

I received a spreadsheet with a list of addresses setup so you can click the name in the cell and it would open. I wanted to export the actual url which is inside the cell.

You can do this with a function. Open the VBA editor with Fn/Option F11 on the Mac. Then Open Modules and insert a new module with a name of your choosing.

Paste in the following function, save and exit the VBA editor

Function GetCellURL(cell As Range) As String
     On Error Resume Next
     GetCellURL = cell.Hyperlinks(1).Address
End Function

Then visit your spreadsheet and start a new column and use your function to reference a cell that has a hyperlink.

=GetCellUrl(A1)

Tags: excel