I have an Excel file with hundreds of cells that use the Hyperlink formula =HYPERLINK(
. I need to extract the plain te
Hm - playing around with it, I couldn't get .Address
to work either.
You say you want to extract the URL only, I was able to do that with this macro:
Function hyperlinkText(pRange As Range) As String
Dim st1 As String, st2 As String
Dim tempSub1 As String, tempSub2 As String
If Left(pRange.Formula, 10) <> "=HYPERLINK" Then
hyperlinkText = "not found"
Exit Function
Else
tempSub1 = WorksheetFunction.Substitute(pRange.Formula, """", "[", 1)
tempSub2 = WorksheetFunction.Substitute(tempSub1, """", "]", 1)
hyperlinkText = Mid(tempSub2, WorksheetFunction.Find("[", tempSub2) + 1, WorksheetFunction.Find("]", tempSub2) - WorksheetFunction.Find("[", tempSub2) - 1)
End If
End Function
Note though, it doesn't get the "Friendly Name" of the Hyperlink()
formula, just the URL.