Excel VBA Excel VBA Automation & Macros 1 — Questions and Answers
Question 1: Which VBA event fires automatically when a workbook is first opened?
- Workbook_Start
- Workbook_Open (Correct answer)
- Workbook_Load
- Workbook_Activate
Correct answer: Workbook_Open
The Workbook_Open event procedure runs automatically each time the workbook is opened.
Question 2: How do you prevent screen flickering while a VBA macro runs?
- Application.DisplayAlerts = False
- Application.ScreenUpdating = False (Correct answer)
- Application.EnableEvents = False
- Application.Calculation = xlManual
Correct answer: Application.ScreenUpdating = False
Setting Application.ScreenUpdating to False suspends screen redraws, eliminating flicker and speeding up macros.
Question 3: Which VBA property disables automatic recalculation during a macro for performance?
- Application.AutoCalc = False
- Application.Calculation = xlManual (Correct answer)
- Application.RecalcMode = xlOff
- Application.FormulaUpdate = False
Correct answer: Application.Calculation = xlManual
Setting Application.Calculation to xlManual prevents Excel from recalculating formulas after every cell change.
Question 4: What does the Application.EnableEvents property control?
- Whether keyboard shortcuts work
- Whether worksheet and workbook event procedures fire automatically (Correct answer)
- Whether the macro recorder is active
- Whether add-ins can run code
Correct answer: Whether worksheet and workbook event procedures fire automatically
Setting EnableEvents to False prevents VBA event procedures from triggering during programmatic changes.
Question 5: How do you run another macro from within a VBA procedure?
- Exec "MacroName"
- Call MacroName or just MacroName (Correct answer)
- Run.Macro "MacroName"
- Application.RunMacro "MacroName"
Correct answer: Call MacroName or just MacroName
You can invoke another subroutine using the Call keyword followed by the name, or simply write the name with arguments.
Question 6: Which method saves the active workbook in VBA without prompting for a file name?
- ActiveWorkbook.SaveCopy()
- ActiveWorkbook.Save() (Correct answer)
- Workbook.QuickSave()
- Application.Save()
Correct answer: ActiveWorkbook.Save()
ActiveWorkbook.Save() saves the workbook to its current file path without displaying a save dialog.
Which VBA event fires automatically when a workbook is first opened?