I am trying to write an excel macros using a loop to go through two columns of dates, comparing the dates in excel and replace some values in another column if the dates are the same.
This is my excel code, could someone tell me what is wrong with it? I keep getting the error Loop without Do.
Sub automatic_replace_using_do_while_loop()
Dim A As Integer, H As Integer
A = 1
H = 1
Do While H < 1186
If Cells(A, 1).Value = Cells(H, 8).Value Then
Cells(H, 6).Value = Cells(i, 11)
H = H + 1
A = A + 1
Else
H = H + 1
Loop
End Sub
Thanks!