- What is Debug.Print
- Debug.Print outputs information to Immediate Window during VBA debugging
- Immediate Window allows real-time code interaction and output viewing
- Used to display variable values, properties, and expressions
- Usage Steps
- Open Visual Basic Editor (ALT + F11)
- Insert new module and write VBA code
- Include Debug.Print statement at desired output points
- Run code through Macro dialog box
- View output in Immediate Window (CTRL + G)
- Examples
- Display variable values using & operator
- Print to file using Open statement
- Calculate factorial using For loop
- Show active workbook name using ThisWorkbook.FullName
- Important Notes
- Debug.Print should be disabled after debugging
- Clear Immediate Window with CTRL + A + DELETE
- Can use conditional logic with If...Then statements
- Different from Print statement, which prints to printer