Why do I get compile error message for the last for next loop?

21 views Asked by At
Sub Step2()
    Dim i As Integer
    Dim j As Integer
    Dim ncol As Integer
    Dim ws As Worksheet: Set ws = Sheets("Detailed Sample Report")

    ws.Range("A1:D11").Value = WorksheetFunction.Transpose(Range("A1:K4"))

    ncol = Sheets("owssvr").Cells(Rows.Count, 1).End(xlUp).Row
    MsgBox (ncol)

    ws.Range("A1:A11").Copy

    For i = 1 To ncol
        NextRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
        ws.Range("A" & NextRow + 1).PasteSpecial xlPasteAll
    Next

    For j = 2 To ncol
        Sheets("owssvr").Range("B" &j& ":B" & j+10).Value =WorksheetFunction.Transpose.Range("A" &j+1 ":K" &j+1)
        j = j + 12

End Sub
0

There are 0 answers