I would like to build an Excel function in VBA that checks the presence of a circular reference in a certain cell. I want the function to return a Boolean "TRUE" if there is a circular reference and "FALSE" otherwise. Here is my failed attempt:
Function CIRC_REF(BadCell As Range) As Boolean
If BadCell.CircularReference = True Then
CIRC_REF = True
Else
CIRC_REF = False
End If
End Function
Unfortunately, this only returns a #VALUE! error in the evaluating cell. I tested it on a Worksheet which A1 = 1, A2 = 2, A3 = A1 + A2 + A3. Then I set B3=CIRC_REF(A3).