View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert P. Stearns Robert P. Stearns is offline
external usenet poster
 
Posts: 3
Default How Do I Trap #VALUE!

I would like to extract the hyperlink from a cell.
I found a nice example on http://www.ozgrid.com/VBA/HyperlinkAddress.htm
which defined the function GetAddress as:

Function GetAddress(HyperlinkCell As Range)
GetAddress = Replace HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function
In cell A2, you can enter the function =GetAddress(A1) to extract the
hyperlink from cell A1.In other cells where I do not have a hyperlink the
function returns #VALUE!. How do I change the function to return "" instead
of #VALUE!?