Quality Control & Assurance Flashcards
7 cards from real Excel VBA practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Quality Control & Assurance flashcards as text
A QA macro must verify that every cell in a summary range references a formula, not a hardcoded value. After identifying violations, which Range method highlights all of them at once?
Answer: Set the Interior.Color property on Application.Union of all violation cells
Building a Union range of all violations and setting Interior.Color in a single statement is faster than looping and setting each cell individually.
Which VBA collection type is best suited for de-duplicating a list of error codes collected during a QA pass?
Answer: A Scripting.Dictionary with error codes as keys
Dictionary keys must be unique, so adding error codes as keys automatically ignores duplicates without extra logic.
A QA automation script must run silently without displaying any Excel alerts or confirmation dialogs. Which setting suppresses these?
Answer: Application.DisplayAlerts = False
Setting DisplayAlerts = False suppresses Excel's built-in dialog boxes; remember to restore it to True after the macro completes.
When a QA macro modifies workbook structure (adds/deletes sheets), which event must be temporarily disabled to prevent cascading event-driven code from firing?
Answer: Application.EnableEvents = False
EnableEvents = False prevents Workbook_SheetChange and similar events from triggering while the macro restructures the workbook.
A QA script must write a structured error report to a new worksheet and then protect it so users cannot edit it. What is the correct sequence?
Answer: Write all data to the sheet first, then call ws.Protect to lock it
Writing data first and then protecting the sheet is the simplest sequence; alternatively, UserInterfaceOnly:=True allows VBA writes to a protected sheet.
Which approach correctly tests that a VBA function returns a specific Err.Number when passed invalid input, without crashing the test runner?
Answer: Use On Error Resume Next before calling the function, then inspect Err.Number immediately after
On Error Resume Next lets execution continue after the error; Err.Number is then immediately available for assertion before it is cleared.
In a VBA QA pipeline, what is the primary benefit of separating data-reading, validation logic, and error-reporting into distinct Sub or Function procedures?
Answer: It makes each component independently testable and replaceable without affecting other stages
Separation of concerns means each procedure can be unit-tested in isolation, and one component can be updated without breaking the others.