If - Then Code Help needed
Here is all the code I am using in case anyone can help put this in the order
it needs to be. I have tried different configurations but always get an error
of some sort. It also needs to keep moving down row by row and checking the
start time in column G. There is a date as well in column F if that helps. It
has gotten so complex that I can't wrap my brain around it anymore.
Range("AJ2").Select
If ("G1").Value TimeSerial(0, 0, 0) _
And Range("G1").Value < TimeSerial(4, 0, 0) Then
ActiveCell.FormulaR1C1 = _
"=IF(RC[-34]=R[-1]C[-34],ROUND(MOD(RC[-29]-R[-1]C[-28],1)_
*1440,0),0)"
Else
ActiveCell.FormulaR1C1 = _
"=IF(RC[-34]=R[-1]C[-34],ROUND(MOD(RC[-29]-MAX(R[-1]C[-28], _
(VLOOKUP(RC[-35],RRInfo,5,FALSE))),1)*1440,0),0)"
End If
Selection.Copy
Range("AJ2:AJ" & Lrow).Select
ActiveSheet.Paste
"Scott" wrote:
I am creating a new column for an Excel program but this column needs to use
two different formulas based on a Start time in column G. If the Start time
is before midnight then I use one fomula and if the start time is after
midnight but before 4 a.m. then I use a different formula. The formulas work
perfect but I can't seem to write the initial condition correctly so that it
knows which formula to use.
Essentially, how could I write an If Then statement that says if the scan
time in cell ( #, G ) is 24:00 and < 04:00 then
Calculation # 1
Else
Calculation # 2
|