Any idea why I get the above error on this code?
VBE is highlighting the bold section.
Column I are dates, T1 is a date, column Q is currency format numbers, column J are numbers. I really don't see what the problem is.
All I'm asking is - if the date in column Q, row i is less than the date in T1 AND Q divided by J is greater than zero (I put that in to get rid of the horrible DIV0 error) - then do the below formula.
I threw in the On Error Resume Next line - clicked run and the code is still apparently running (though I think Excel has crashed). Grrrr...
Code:
Sub FixBNIREF()
Dim i As Long, LR As Long
LR = Range("Q" & Rows.Count).End(xlUp).Row
For i = 1 To LR
[B] If Range("I" & i) < Range("T1") And (Range("Q" & i).Value / Range("J" & i).Value) > 0 Then[/B]
Range("Q" & i).Value = Range("Q" & i).Value - ((Range("Q" & i).Value / Range("J" & i).Value) * (Range("AG" & i).Value))
Range("I" & i).Value = Range("T1").Value
End If
Next i
End Sub
VBE is highlighting the bold section.
Column I are dates, T1 is a date, column Q is currency format numbers, column J are numbers. I really don't see what the problem is.
All I'm asking is - if the date in column Q, row i is less than the date in T1 AND Q divided by J is greater than zero (I put that in to get rid of the horrible DIV0 error) - then do the below formula.
I threw in the On Error Resume Next line - clicked run and the code is still apparently running (though I think Excel has crashed). Grrrr...
Last edited: