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
Which error-handling structure ensures cleanup code runs regardless of whether an error occurred in a VBA QA routine?
Answer: On Error GoTo ErrHandler with a Cleanup label called before both normal exit and the error branch
Routing both the normal exit and the error branch through a shared Cleanup label guarantees resources are released in all scenarios.
A QA macro compares values from two worksheets. Which method efficiently finds the intersection of two named ranges for comparison?
Answer: Application.Intersect(range1, range2)
Application.Intersect returns a Range object representing cells common to both ranges, or Nothing if they don't overlap.
When a VBA QA script must check whether a cell's value matches a list of approved codes stored in an array, which approach is correct?
Answer: Use Application.Match(cell.Value, approvedArray, 0) and check for an error
Application.Match against a Variant array returns an error if not found; wrapping it in IsError provides a clean Boolean check.
Which property of a Range object returns True if the cell contains a formula rather than a constant value?
Answer: Range.HasFormula
The HasFormula property returns True when the cell (or all cells in a multi-cell range) contains a formula.
A QA sub must verify that all numeric cells in a report column are formatted as currency. Which property should it inspect?
Answer: cell.NumberFormat
The NumberFormat property contains the format string (e.g., '$#,##0.00') applied to the cell and can be compared against expected currency patterns.
In Excel VBA, what is the purpose of using Assert statements from a custom testing framework compared to standard error handling?
Answer: Custom Assert subs raise descriptive test-failure errors that identify which condition failed, unlike generic Err objects
A custom Assert sub raises a meaningful error with context (expected vs. actual) when a condition fails, making QA test failures easier to diagnose.
What technique prevents a QA macro from modifying production data while it runs validation checks on a live workbook?
Answer: Open the workbook using Workbooks.Open with ReadOnly:=True
Opening the workbook with ReadOnly:=True ensures VBA can read all data without the ability to save any unintended changes back.