Home Technical Help Get URL from Hyperlink in Excel using VB script
Get URL from Hyperlink in Excel using VB script PDF Print E-mail
Written by Administrator   


To get and transform a hyperlink in cell(s) contained in an Excel worksheet you need to create a small VB script snipet. You need to put the VB script in a module in Visual Basic editor. Follow the below instructions to create a function in Excel to get the hyperlink from Excel.



1. On Developer tab click > Visual Basic (or press ALT + F11 (Opens Visual Basic Editor))

2. Click on Insert -> Module (adds a module to your excel file)

3. Paste the code below for the function of GETURL from below:


Function GETURL(HyperlinkCell As Range)
GETURL = HyperlinkCell.Hyperlinks(1).Address
End Function


4. Save


5. Exite visual basic editor (press ALT + Q to close the Visual Basic Editor)


Now use the =GETURL(cell) to get the URL


Example: =GETURL(A1) will return the URL for the Hyperlink displayed in cell A1


If you can't see the Developer tab click here to activate the tab.