I have written code to delete rows where where are zeroes in Col K from row 2 onwards from sheet "Upload JNL BRT" onwards
When running the macro, I get a compile error "Invalid Next control variable reference"
Next I is highlighted
It would be appreciated if someone could amend my code and advise where I have gone wrong
When running the macro, I get a compile error "Invalid Next control variable reference"
Next I is highlighted
Code:
Sub Delete_Zeroes()
Dim Lr As Long, i As Long, J As Long
For i = Sheets("Upload JNL BRT").Index To Worksheets.Count
With Worksheets(i)
Lr = Range("A" & .Rows.Count).End(xlUp).Row
Debug.Print Lr
For J = Lr To 1 Step -1
If .Range("K" & J).Value = 0 And Not IsEmpty(.Range("K" & J)) Then _
.Range("K" & J).EntireRow.Delete
Next i
End Sub
It would be appreciated if someone could amend my code and advise where I have gone wrong