Trying to run the following loop but keep getting an invalid next control variable reference error. Cannot seem to work out the solution and I am sure it is a simple one.
The code works fine without the loop but when I have added the loop it has now failed.
Sub QC()
Dim i, j As Integer
Dim ws As String
For i = 1 To 2
For j = 0 To 1
ws = "Settings"
Worksheets(ws).Range(Worksheets("QC").Cells(i * 5 - j, 2)) = Worksheets("QC").Cells(i * 5 - j, 3)
Worksheets("QC").Cells(8, 5) = Worksheets("CE Results").Cells(9, 9)
Worksheets(ws).Range(Worksheets("QC").Cells(i * 5 - j, 2)) = Worksheets("QC").Cells(i * 5, 2)
Worksheets(ws).Range(Worksheets("QC").Cells(i * 5 - j, 2)) = Worksheets("QC").Cells(i * 5 + j, 3)
Worksheets("QC").Cells(10, 5) = Worksheets("CE Results").Cells(9, 9)
Worksheets(ws).Range(Worksheets("QC").Cells(i * 5 - j, 2)) = Worksheets("QC").Cells(i * 5, 2)
Next i
Next k
End Sub