information function - does cell contain reference

R

R of Steinke

I want to create a formula that returns TRUE if the reference cell contains a
reference to any other cell and FALSE if the reference cell is a number or
text.

ISREF doesn't seem to work.
 
J

JE McGimpsey

One way:

Public Function HasPrecedents(rRng As Range) As Variant
Dim rTest As Range
If rRng.Count > 1 Then
HasPrecedents = CVErr(xlErrRef)
Else
On Error Resume Next
Set rTest = rRng.Precedents
On Error GoTo 0
HasPrecedents = Not rTest Is Nothing
End If
End Function


If you're not familiar with UDFs, see:


http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Top