ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   information function - does cell contain reference (https://www.excelbanter.com/excel-worksheet-functions/74234-information-function-does-cell-contain-reference.html)

R of Steinke

information function - does cell contain reference
 
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.

JE McGimpsey

information function - does cell contain reference
 
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


In article ,
R of Steinke wrote:

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.



All times are GMT +1. The time now is 12:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com