โ† All Excel VBA Flashcard Decks

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
  1. Which VBA approach best validates that a user-entered date falls within a fiscal year range before processing?

    Answer: Use IsDate() to confirm it's a date, then compare the value to fiscal start/end date variables

    IsDate() confirms the value is a valid date before numeric date comparisons are made against fiscal boundary variables.

  2. A QA macro must abort and log an error if a required worksheet named 'Data' is missing. Which code pattern is correct?

    Answer: On Error Resume Next: Set ws = Sheets('Data'): On Error GoTo 0: If ws Is Nothing Then GoTo ErrLog

    Using On Error Resume Next lets VBA attempt the assignment; if the sheet is missing, ws remains Nothing, triggering the error branch.

  3. When auditing cell formulas in a QA macro, which property returns the formula string of a cell?

    Answer: Cell.Formula

    Cell.Formula returns the formula as entered in A1 notation, suitable for string inspection in QA routines.

  4. A QA sub needs to flag all cells in column B that contain negative numbers. Which loop construct is most appropriate?

    Answer: For Each cell In Columns('B').SpecialCells(xlCellTypeConstants, xlNumbers)

    SpecialCells(xlCellTypeConstants, xlNumbers) restricts the loop to cells with numeric constants, avoiding blank/formula cells and improving performance.

  5. Which VBA statement writes a QA error message to the Immediate Window without halting execution?

    Answer: Debug.Print 'Error: ' & msg

    Debug.Print outputs text to the Immediate Window at runtime without pausing or stopping the macro.

  6. A data-validation macro must ensure no duplicate order IDs exist in column A. Which WorksheetFunction is most efficient for this check?

    Answer: Application.WorksheetFunction.CountIf

    CountIf can count occurrences of each ID; any result greater than 1 flags a duplicate without needing a helper column.

  7. In a QA macro, what does setting Application.ScreenUpdating = False accomplish?

    Answer: Stops the screen from refreshing, speeding up macro execution

    Disabling ScreenUpdating prevents Excel from repainting the UI on each change, which significantly speeds up macros that modify many cells.