How to extract a web address from a hyperlink cell?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I hava column of data that shows "friendly" website names. I want to extract
the actual website URLs that are embedded in the data. Anyone know how?
 
Use this tiny UDF:

Function hyp(r As Range) As String
Dim s As String

If r.HasFormula Then
s = r.Formula
s_array = Split(s, Chr(34))
hyp = s_array(1)
Else
hyp = r.Hyperlinks(1).Address
End If
End Function


for example =hyp(A1)

This will work if either the hyperlink was inserted directly or via the
=HYPERLINK() function.
 
Thanks GS; that worked perfectly.

Gary''s Student said:
Use this tiny UDF:

Function hyp(r As Range) As String
Dim s As String

If r.HasFormula Then
s = r.Formula
s_array = Split(s, Chr(34))
hyp = s_array(1)
Else
hyp = r.Hyperlinks(1).Address
End If
End Function


for example =hyp(A1)

This will work if either the hyperlink was inserted directly or via the
=HYPERLINK() function.
 
Back
Top