PDA

View Full Version : sum all cells with formula



lior03
08-04-2006, 10:06 AM
hello
i want to use a msgbox to sum a total of all cells in a range that has a formula
Sub sumformula()
Dim cell As Range
For Each cell In selection
If cell.HasFormula = True Then
MsgBox cell.Value + 1
End If
Next
End Sub
i got lost.
thanks

xld
08-04-2006, 10:11 AM
Sub sumformula()
Dim cell As Range
Dim nSum As Variant
For Each cell In Selection
If cell.HasFormula = True Then
nSum = nSum + cell.Value
End If
Next
MsgBox nSum
End Sub