Right-click on any object for the workbook in which you want to get this function to extract URLs from hyperlinks.In case it’s not there, you can click on the ‘View’ tab and then click on the ‘Project Explorer’ option In the left part of the window, you should have the project explorer pane.Hold the ALT key and press the F11 key (Opt + F11 or Fn + Opt + F11 if you’re using Mac).Open the workbook where you want to add this VBA code.Now let me give you the exact steps on how to add this VBA code in the: While there are more than 450+ functions in Excel, in case you can’t find one that suits your need, you can create your own custom formula as well.īelow is a dataset where I have the cells with hyperlinks and I want to extract the URL from each cell’s hyperlink.īelow is the VBA code that will create a custom function (ExtractURL) that can work just like a regular function in the worksheets: Function ExtractURL(rng As Range) As String Extract URL from Hyperlinks in Adjacent Cell using VBA MacroĮxtract URL from Hyperlinks Using Formula.Extract URL from Hyperlinks Using Formula.