VBA interview questionsTechnical interview questions
← Interview & exam prep
Technical interview questions

VBA interview questions

13 questions from beginner to advanced, each with the correct answer and a one-line explanation of why. Study them here, or take them as a timed test.

13 questionsBeginner 7 · Intermediate 6Answers + explanations
Take it as a timed test
Free PDF
All 389 questions & answers, in one file

DAX, Excel, Power BI, Fabric, certification practice and analyst interviews — every answer with the reason behind it. Print it, study it offline.

Instant download, plus the free Tuesday briefing. Unsubscribe in one click.

Beginner 7 questions

1Which keyword DECLARES a variable in VBA?

  1. Var
  2. Set
  3. Let
  4. Dim
  5. Declare
Show answerHide answer

D · Dim Dim declares a variable (e.g., Dim i As Long).

2To assign an OBJECT reference to a variable you use…

  1. Set
  2. Assign
  3. Let
  4. =
  5. Bind
Show answerHide answer

A · Set Objects require Set (e.g., Set ws = Worksheets(1)); scalars use a plain =.

3A comment in VBA begins with…

  1. #
  2. '
  3. /*
  4. //
  5. --
Show answerHide answer

B · ' An apostrophe starts a comment; the rest of the line is ignored.

4Option Explicit forces you to…

  1. Declare every variable before use
  2. Use early binding
  3. Turn off screen updating
  4. Compile faster
  5. Use error handling
Show answerHide answer

A · Declare every variable before use Option Explicit prevents typos by requiring all variables to be declared.

5Which event fires when a cell value on a sheet changes?

  1. Worksheet_Change
  2. Worksheet_Activate
  3. OnEdit
  4. Workbook_Open
  5. Worksheet_Calculate
Show answerHide answer

A · Worksheet_Change Worksheet_Change runs when the user edits a cell on that sheet.

6To loop over every cell in a range, use…

  1. GoTo
  2. DoEvents
  3. Select Case
  4. With rng
  5. For Each cell In rng
Show answerHide answer

E · For Each cell In rng For Each … In iterates a collection such as the cells of a range.

7To stop the screen from flickering during a macro, set…

  1. Application.Calculation = False
  2. Application.ScreenUpdating = False
  3. Range.Clear
  4. DoEvents
  5. Application.Quit
Show answerHide answer

B · Application.ScreenUpdating = False ScreenUpdating = False suppresses redraws (remember to set it back to True).

Intermediate 6 questions

8A Function differs from a Sub because a Function…

  1. Is public only
  2. Runs faster
  3. Cannot take arguments
  4. Cannot be called
  5. Returns a value
Show answerHide answer

E · Returns a value A Function returns a value to the caller; a Sub performs actions without returning one.

9ByVal passes an argument as…

  1. A copy of the value
  2. An object only
  3. Nothing
  4. A reference to the original
  5. A global
Show answerHide answer

A · A copy of the value ByVal passes a copy, so changes don't affect the caller; ByRef passes a reference.

10Runtime error handling in VBA uses…

  1. catch { }
  2. On Error GoTo label
  3. Try / Catch
  4. On Error Ignore
  5. IFERROR
Show answerHide answer

B · On Error GoTo label On Error GoTo redirects execution to a labelled handler; Resume/Resume Next control flow after.

11Early binding (vs late binding) means…

  1. Running without references
  2. Declaring As Object
  3. Binding at shutdown
  4. Setting a library reference and typed variables at compile time (IntelliSense)
  5. Using CreateObject only
Show answerHide answer

D · Setting a library reference and typed variables at compile time (IntelliSense) Early binding references the type library up front, enabling IntelliSense and compile-time checks.

12To get the actually-used area of a sheet, use…

  1. Range("A1")
  2. ActiveCell
  3. Worksheet.UsedRange
  4. Cells.Count
  5. Selection
Show answerHide answer

C · Worksheet.UsedRange UsedRange returns the rectangle spanning the used cells of the worksheet.

13A Scripting.Dictionary is preferred over a Collection when you need…

  1. Less memory always
  2. Keyed lookup with .Exists and unique keys
  3. No references
  4. Charts
  5. Ordered numbers
Show answerHide answer

B · Keyed lookup with .Exists and unique keys Dictionaries support key existence checks and value updates by key, unlike the basic Collection.

What changed lately? Latest VBA & Macros news, releases & questions →

Coming soon $19 one-time · early-access price
Prep Pro: full mock exams
  • Full-length, timed mock exams in the real PL-300, DP-600 and MO-201 format
  • Score breakdown by skill, with a study plan for your weak spots
  • New questions every month, written against the current exam outline

No payment now. We'll email you once, when it opens.

More technical interview questions