I have a macro that has a loop in it. Because I don't know what else I can use to end the loop, it is written to "End Sub" if certain criteria is met.
After the text for the loop ends, I still have a few lines of code.
Once the criteria for ending the loop is met though, the macro stops and the last few lines of script are ignored.
Any suggestions?
Below is the loop, as well as the lines that are being skipped:
Do Until ActiveCell.Row = 65536
Selection.End(xlDown).Select
Selection.ClearContents
If ActiveCell.Row = 65536 Then Exit Sub
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
Range("Q1").Select
Loop
Selection.AutoFilter Field:=17
Range("A1").Select
End Sub
After the text for the loop ends, I still have a few lines of code.
Once the criteria for ending the loop is met though, the macro stops and the last few lines of script are ignored.
Any suggestions?
Below is the loop, as well as the lines that are being skipped:
Do Until ActiveCell.Row = 65536
Selection.End(xlDown).Select
Selection.ClearContents
If ActiveCell.Row = 65536 Then Exit Sub
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
Range("Q1").Select
Loop
Selection.AutoFilter Field:=17
Range("A1").Select
End Sub