Reference Hyperlink

  • Thread starter Thread starter Clark Murray
  • Start date Start date
C

Clark Murray

If you have entries in cells that contain mailto hyperlinks, is there any way to reference only the mailto address from another cell?
 
You could use a user defined function:

Option Explicit
Function GetLink(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetLink = ""
Else
GetLink = Rng.Hyperlinks(1).Address
End If
End Function

So if cell A1 contained a link to mailto:[email protected]
then =getlink(a1) would return this: mailto:[email protected]

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Back
Top