Which VBA keyword is used to declare a variable?
a) DIM
b) VAR
c) LET
d) DECLARE
Answer: a) DIM
What does the VBA Sub keyword define?
a) A function
b) A procedure
c) A variable
d) A loop
Answer: b) A procedure
Which VBA function is used to display a message box?
a) MsgBox
b) AlertBox
c) ShowMessage
d) DisplayBox
Answer: a) MsgBox
How do you end a VBA subroutine?
a) END
b) EXIT
c) END SUB
d) STOP
Answer: c) END SUB
In VBA, what does the Range("A1").Value refer to?
a) The cell format of cell A1
b) The address of cell A1
c) The value stored in cell A1
d) The formula in cell A1
Answer: c) The value stored in cell A1
Which VBA statement is used to loop through a range of cells?
a) FOR EACH
b) WHILE
c) DO UNTIL
d) REPEAT
Answer: a) FOR EACH
What does the Cells(1, 1).Value notation represent in VBA?
a) The value of cell A1
b) The value of cell B1
c) The value of cell A2
d) The value of cell B2
Answer: a) The value of cell A1
Which VBA function is used to get user input in a dialog box?
a) InputBox
b) GetUserInput
c) Prompt
d) UserResponse
Answer: a) InputBox
How do you create a loop that runs from 1 to 10 in VBA?
a) FOR i = 1 TO 10
b) LOOP 1 TO 10
c) REPEAT 1 TO 10
d) WHILE i < 10
Answer: a) FOR i = 1 TO 10
Which VBA keyword is used to handle errors?
a) HANDLE
b) ERROR
c) ON ERROR
d) TRY
Answer: c) ON ERROR