I want to drop down to the next "currentrow" after the count reaches 16 and continue on from the "currentcolumn".
The only way the counter works is if I use end or exit sub, but that is not what I want to do.
Dim CurrentColumn As Integer, XColumn As Integer, CurrentRow As Long, Totalrow As Long, Count As Long
With ActiveSheet
CurrentColumn = 7
XColumn = 106
Totalrow = 299
Do Until CurrentColumn = 103
CurrentRow = 11
Totalrow = .cells(8, CurrentColumn).Value
''Count = 1
While Totalrow < Range("I383").Value And CurrentRow < 298
If .cells(CurrentRow, CurrentColumn).Value = "." Then
If .cells(CurrentRow, XColumn).Value = "x" _
And CurrentColumn >= 27 _
And .cells(CurrentRow, CurrentColumn).Offset(0, -1) <> "." Then
.cells(CurrentRow, CurrentColumn).Value = "LVD"
Count = Count + 1
If Count > 16 Then End '<<<<<<<<
Totalrow = Totalrow + 1
End If
End If
CurrentRow = CurrentRow + 1
Wend
CurrentColumn = CurrentColumn + 1
Loop
End With
The only way the counter works is if I use end or exit sub, but that is not what I want to do.
Dim CurrentColumn As Integer, XColumn As Integer, CurrentRow As Long, Totalrow As Long, Count As Long
With ActiveSheet
CurrentColumn = 7
XColumn = 106
Totalrow = 299
Do Until CurrentColumn = 103
CurrentRow = 11
Totalrow = .cells(8, CurrentColumn).Value
''Count = 1
While Totalrow < Range("I383").Value And CurrentRow < 298
If .cells(CurrentRow, CurrentColumn).Value = "." Then
If .cells(CurrentRow, XColumn).Value = "x" _
And CurrentColumn >= 27 _
And .cells(CurrentRow, CurrentColumn).Offset(0, -1) <> "." Then
.cells(CurrentRow, CurrentColumn).Value = "LVD"
Count = Count + 1
If Count > 16 Then End '<<<<<<<<
Totalrow = Totalrow + 1
End If
End If
CurrentRow = CurrentRow + 1
Wend
CurrentColumn = CurrentColumn + 1
Loop
End With
Code: