Nested If Then
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]5,""Early"",IF(RC[-1]=0,""On Time"",IF(RC[-1]<0,""Late"")))"
worked for me.
--
Regards,
Tom Ogilvy
"jmdaniel" wrote in message
...
I am trying to return the words "Early, "Late", or "On Time" to a column
of cells, depending on what the value was in the column just to the left. It
worked great when I used the macro recorder to just test for one condition,
and return one of two possibilities, but when I tried to nest all the
possibilities, I get an error on the Active Cell.Formula line. The debug
help isn't, so I thought I would ask if I have this line written correctly.
Thanks!
' Inserts Early, On Time, or Late
Range("N2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]5,""Early"",IF(RC[-1]=0,""On
Time"",IF(RC[-1]<0,""Late"")))"""
ActiveCell.Offset(1, -1).Select
End If
Loop Until IsEmpty(ActiveCell) = True
|