ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Nested If Then (https://www.excelbanter.com/excel-programming/304763-re-nested-if-then.html)

Tom Ogilvy

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




sp00nix[_6_]

Nested If Then
 
I do love VBA, but for larger programs I'd rather use as many exce
function-shortcuts as i can, because they run a lot quicker and wil
speed up the program tremendously!
just my 2-cents...
Mik

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com