K
Kevin Beckham
I can't get the following function to return the direct dependents
Function ResolveFormula(ByRef rngCell As Range, iColLabels As Integer) As
String
Dim sCell As String
Dim rngPrec As Range
sCell = rngCell.Formula
For Each rngPrec In rngCell.DirectPrecedents
With rngPrec
sCell = Replace(sCell, rngPrec.Address(False, False, xlA1), _
.Offset(0, iColLabels - .Column + 1).Value)
End With
Next rngPrec
ResolveFormula = sCell
End Function
For the worksheet
A 1
B 2
=B1 * B2 =ResolveFormula(B3, 1)
to give =A * B
TIA
Kevin Beckham
Function ResolveFormula(ByRef rngCell As Range, iColLabels As Integer) As
String
Dim sCell As String
Dim rngPrec As Range
sCell = rngCell.Formula
For Each rngPrec In rngCell.DirectPrecedents
With rngPrec
sCell = Replace(sCell, rngPrec.Address(False, False, xlA1), _
.Offset(0, iColLabels - .Column + 1).Value)
End With
Next rngPrec
ResolveFormula = sCell
End Function
For the worksheet
A 1
B 2
=B1 * B2 =ResolveFormula(B3, 1)
to give =A * B
TIA
Kevin Beckham