'Next without for

I am receiving next without for error from:

Sub CTLines()
Dim iVal As Integer
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rng As Range

Set ws1 = Worksheets("INCIDENTS")
Set ws2 = Worksheets("INCDB")

iVal = Application.WorksheetFunction.CountIf(Range("AO5:AO999"), "Yes")

Dim i

For i = 1 To iVal
    With Sheets("INCDB")
        .Range("5:5").Insert Shift:=x1Down
Next i
End Sub

I've tried changing the variable, the indent, many things and I've not been successful.

All I want to do is to count how many rows contain Yes in the AO column and add as many rows in the INCDB spreadsheet.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source