Is there a VBA command that causes debugging at this point?

The context of this question is that I use message boxes as a tool to help me familiarize myself with a fairly large number of VBA macros that work in the Excel workbook collection.

I carefully insert the messages into the code that appears and says / reminds me where we are in the code. I would like to have a button in these blocks that will lead me to debug the code at this point.

My solution at present is to divide by zero if the Yes button is selected. Here is an example snippet:

Dim MyError as Double ... If MsgBox("Just entered function XYZ(). Want to debug?", vbYesNo + vbDefaultButton2) = vbYes Then MyError = 1# / 0 

It works, but not very elegant.

I was hoping there was a command that would launch VBA debugging mode when the command is called.

+8
vba excel-vba excel
source share
2 answers

The Stop command does this for you:

 If MsgBox("Just entered function XYZ(). Want to debug?", vbYesNo + vbDefaultButton2) = vbYes Then Stop 
+8
source share

Yes there is:

 Debug.Assert False 
+7
source share

All Articles