Debug.Assert is useful to break your code on a certain condition so that you may step through it. For example if your code is failing due to a condition that you don't believe must occur, or after a point in a loop, you can add a test for that:
Of course you may also achieve the same with watches or Stop statements.![]()
Sub assertive() Dim n As Long For n = 1 To 100 ' you can step through after n = 60 Debug.Assert n <> 60 Next n End Sub
Bookmarks