I created this macro to correct an error (to fill blank created by Feb 29 in non-leap years)i have been facing problem in stopping the Do Until loop.
the macro does what it is supposed to do but it is not working as supposed to with Do Until ActiveSheet.Cells(3, x) = "2012"
i want it to stop when cell (3,x) is 2012
Sub Feb_CORRECTION()
Dim i, x As Integer
Dim year
Dim leapyear
Range("c64").Select
x = 3
Do Until ActiveSheet.Cells(3, x) = "2012"
year = ActiveSheet.Cells(3, x)
leapyear = year Mod 4
If leapyear > 0 Then
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Cut
ActiveCell.Offset(-1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(1, 1).Select
Else
ActiveCell.Offset(0, 1).Select
x = x + 1
End If
Loop
End Sub
thank you