Extract URL from Hyperlink in Microsoft Excel with VBA

If you want to extract hyperlink url value from an cell in Microsoft Excel you can automate this process with writing a macro.

  • Press Alt + F11 to open VBA console.
  • Insert > Module to open module editor.
  • Copy + Paste the following code to implement functionality.
Sub ExtractURLFromCell()

   Dim cellRange As Range
   For Each cellRange In Selection
       cellRange.Offset(0, 1).Value = cellRange.Hyperlinks(1).Address
   Next cellRange

End Sub

To use this script;

  • Select the range of cell from which to extract the URL.
  • Press Alt + F8 to open macro list.
  • Select ExtractURLFromCell macro.
  • Press Run
Tags:, ,

Add a Comment

Your email address will not be published. Required fields are marked *