Skip to content

Instantly share code, notes, and snippets.

@spjeff
Created September 2, 2020 11:26
Show Gist options
  • Save spjeff/3bc836e46c57f9422e9ca592d8ecbb22 to your computer and use it in GitHub Desktop.
Save spjeff/3bc836e46c57f9422e9ca592d8ecbb22 to your computer and use it in GitHub Desktop.
' from https://howtouseexcel.net/how-to-extract-a-url-from-a-hyperlink-on-excel
Function GetURL(cell As range, _
Optional default_value As Variant)
'Lists the Hyperlink Address for a Given Cell
'If cell does not contain a hyperlink, return default_value
If (cell.range("A1").Hyperlinks.Count <> 1) Then
GetURL = default_value
Else
GetURL = cell.range("A1").Hyperlinks(1).Address & "#" & cell.range("A1").Hyperlinks(1).SubAddress
End If
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment