VBA colleagues:
I've got this VBA compile error: Next without For, when my code seems ok, though I realize some nuance could be missing or wrong.
Here's the code getting the error message:
For i = 5 To nlines
Range("A" & i).Select
If TestDates(ActiveCell.Value, "04/30/2011") = "1" Then
ActiveCell.Offset(0, 13).Value = ActiveCell.Offset(0, 10).Value
ActiveCell.Offset(0, 19).Value = ActiveCell.Offset(0, 10).Value
Else
If TestDates(ActiveCell.Value, "04/30/2011") = "0" Then
ActiveCell.Offset(0, 12).Value = ActiveCell.Offset(0, 10).Value
ActiveCell.Offset(0, 19).Value = ActiveCell.Offset(0, 10).Value
End If
Next i
Above, TestDates is a function doing date differential calculations on 2 different dates, returning the difference stated as a month (0,1,2,3 etc)
The TestDates function works fine in another module that calls it.
Thank you in advance for any guidance, feedback.
I've got this VBA compile error: Next without For, when my code seems ok, though I realize some nuance could be missing or wrong.
Here's the code getting the error message:
For i = 5 To nlines
Range("A" & i).Select
If TestDates(ActiveCell.Value, "04/30/2011") = "1" Then
ActiveCell.Offset(0, 13).Value = ActiveCell.Offset(0, 10).Value
ActiveCell.Offset(0, 19).Value = ActiveCell.Offset(0, 10).Value
Else
If TestDates(ActiveCell.Value, "04/30/2011") = "0" Then
ActiveCell.Offset(0, 12).Value = ActiveCell.Offset(0, 10).Value
ActiveCell.Offset(0, 19).Value = ActiveCell.Offset(0, 10).Value
End If
Next i
Above, TestDates is a function doing date differential calculations on 2 different dates, returning the difference stated as a month (0,1,2,3 etc)
The TestDates function works fine in another module that calls it.
Thank you in advance for any guidance, feedback.