As an alternative to using MsgBox functions in your code, you can insert one or more temporary Debug.Print statements. Use these statements to print the value of one or more variables in the Immediate window. Here's an example that displays the value of three variables:
Debug.Print LoopIndex, CellCount, MyVal
Notice that the variables are separated with a comma. You can display as many variables as you like using a single Debug.Print statement. If VBE's Immediate window is not visible, press Ctrl+G.
After you've debugged your code, make sure to remove all of the Debug.Print statements.
Was this article helpful?