#DIV0!
Try it this way:
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[1]=0,0,(R[-1]C/R[-1]C[1]))"
--
Hope that helps.
Vergel Adriano
"CV323" wrote:
When I use this code, I'd like to divide cells, sometimes it's dividing by 0s
which results in #DIV0!, how can i make this return a zero instead? Or am I
using the wrong code?
Range("D59").Select
ActiveCell.FormulaR1C1 = "=(R[-1]C/R[-1]C[1])"
If IsError(ActiveCell.Value) Then
errval = ActiveCell.Value
Select Case errval
Case CVErr(xlErrRef)
ActiveCell.Value = 0
Case Else
'
End Select
End If
|