I am having problems with my code on Excel VBA. I am trying to write a nested loop. But I keep getting the compile error: Next without For ( the line with Next r)
Here's my code
Sub clear()
r = 2
i = 310
For c = 15 To 28
r = 2
i = 310
For r = 2 To 306
If Cells(r, c) > Cells(306, c) Then
If Cells(r, 4) <> Cells(i - 1, c) Then
[ Cells(i, c) = Cells(r, 4) i = i + 1]
r = r + 1
Next r
Cells(308, c) = i - 309
Next c
End Sub
Thanks in advance