Tuesday, June 23, 2020

Use of Debug Print in Excel VBA

Debug.Print is used to see that how your code works. It is very useful tool in VBA. Many people get confused about where the output ends up. This can be useful when you want to see the value of a variable in a certain line of your code, without having to store the variable somewhere in the workbook or show it in a message box.

Debug. Print is telling VBA to print that information in the Immediate Window. To view this window you can use the the shortcut key Ctrl + G

OR

Follow the Following steps:
  1. Open the Visual Basic Editor in Excel by pressing the Alt + F11 Key, then
  2. Go to the View Menu and then
  3. Select the Immediate Window option.
Note: Debug.Print will still write values to the window even if it is not visible.

Below is the Debug.Print example for your reference:

VBA-DebugPrint-Example




No comments:

Post a Comment