Thanks to @TimWilliams and @brettdj for pointing me in the right direction to previous discussions on this topic, I can say with confidence:
NO, EXCEL DOES NOT HOW TO DETERMINE.
However, for my rather minimal goals, I came up with something that works, works with cross-sheet links, and can be called from UDF.
However, it is extremely fragile, and there are many perfectly legal formulas that, I am sure, it will not process properly.
The code is a mess and can be greatly improved, but I just wanted to drop it here while I switch to something else for a while ....
EDIT
Also found this that looks very interesting:
http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/
Public Function CellPrecedents(cell As Range) As Variant() Dim resultRanges As New Collection If cell.Cells.count <> 1 Then GoTo exit_CellPrecedents If cell.HasFormula = False Then GoTo exit_CellPrecedents Dim formula As String formula = Mid(cell.formula, 2, Len(cell.formula) - 1) If IsRange(formula) Then resultRanges.Add Range(formula), 1 Else Dim elements() As String 'Debug.Print formula & " --> " formula = Replace(formula, "(", "") formula = Replace(formula, ")", "") 'Debug.Print formula & " --> " elements() = SplitMultiDelims(formula, "+-*/\^") Dim n As Long, count As Integer For n = LBound(elements) To UBound(elements) If IsRange(elements(n)) Then 'ACTUALLY JUST DO A REDIM PRESERVE HERE!!!! count = count + 1 'resultRanges.Add Range(Trim(elements(n))) '<--- Do **NOT** store as a range, as that gets automatically Eval()'d resultRanges.Add Trim(elements(n)) End If Next End If Dim resultRangeArray() As Variant ReDim resultRangeArray(resultRanges.count) Dim i As Integer For i = 1 To resultRanges.count resultRangeArray(i) = CStr(resultRanges(i)) '// have to store as a string so Eval() doesn't get invoked (I think??) Next CellPrecedents = resultRangeArray exit_CellPrecedents: Exit Function End Function Public Function IsRange(var As Variant) As Boolean On Error Resume Next Dim rng As Range: Set rng = Range(var) If err.Number = 0 Then IsRange = True End Function
(just google SplitMultiDelims for this function)
tbone source share