How to reverse a For loop

前端 未结 3 1380
南笙
南笙 2020-12-11 02:49

I have a problem with my macro. It deletes row that fullfil certain criteria. But when few consecutive rows fullfil those criteria an error occurs. When the row is deleted t

3条回答
  •  不知归路
    2020-12-11 03:38

    Loop forward:

    For i = 1 To 10
        'Do something
    Next i
    

    Loop backwards (use Step -1 at the end of the for loop):

    For i = 10 To 1 Step -1
        'Do something
    Next i
    

提交回复
热议问题