View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ardus Petus Ardus Petus is offline
external usenet poster
 
Posts: 718
Default Test for Hyperlink

Function HasLink(rCell As Range) As Boolean
Application.Volatile
If rCell.Count 1 Then
HasLink = CVErr(xlErrRef)
Else
HasLink = _
(rCell.Hyperlinks.Count 0) _
Or Left(rCell.Formula, 10) = "=HYPERLINK"
End If
End Function

You must press F9 to update the results

HTH
--
AP

"Gary''s Student" a écrit dans le
message de news: ...
I need a simple Boolean function that will return TRUE if a cell contains a
hyperlink, otherwise FALSE.

For example, if A1 contained a hyperlink or contained a formula like

=HYPERLINK("http://www.cnn.com","news")

then haslink(A1) would return TRUE.
--
Gary's Student