Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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!?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How Do I Trap #VALUE!

Robert,

Function GetAddress(HyperlinkCell As Range)
GetAddress = ""
On Error Resume Next
GetAddress = Replace( _
HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function

HTH,
Bernie
MS Excel MVP

"Robert P. Stearns" wrote in message
news:zROYb.71578$uV3.527746@attbi_s51...
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!?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How Do I Trap #VALUE!

Bernie,

That did exactly what I wanted.

Thank You!

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Robert,

Function GetAddress(HyperlinkCell As Range)
GetAddress = ""
On Error Resume Next
GetAddress = Replace( _
HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function

HTH,
Bernie
MS Excel MVP

"Robert P. Stearns" wrote in message
news:zROYb.71578$uV3.527746@attbi_s51...
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!?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trap #Div/0 in conditional formatting Neil Excel Discussion (Misc queries) 2 December 16th 04 10:19 AM
Trap Right CLick Insert Von Shean Excel Programming 1 January 22nd 04 04:42 AM
error trap Rhonda[_3_] Excel Programming 2 October 22nd 03 07:07 PM
how to trap a event coming from a dll E.Anderegg Excel Programming 6 October 16th 03 01:53 PM


All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"