Home > Visual Basic Programming > Quizzes > Visual Basic for Applications (VBA) Quiz
Visual Basic for Applications (VBA) Quiz
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 0% Most missed: “What is one way to duplicate a user form from one project into a different proje…”

Visual Basic for Applications (VBA) MCQs For LinkedIn Skill Assessments.

Visual Basic for Applications (VBA) Quiz
Time left 00:00
25 Questions

1. If VBA code declares FileCount as a constant rather than a variable, the code tends to run faster. Why is this?
2. How many values can MyArray hold?

Option Base 0
Sub BuildArray()
Dim MyArray(5) As Integer
3. When used with an array named MyArray, what is the preerred way to set beginning and ending values of a loop control variable?
4. To use VBA code to maintain a different VBA project, you can make use of VBA's extensibility. What is needed to enable extensibility?
5. How do you add a user form to a VBA project?
6. Which code block from class modules returns a compile error?
7. What is the value of Test3?

Enum TestEnum
Test1
Test2
Test3
End Enum
8. The VBA code block shown in the following four options runs when UserForm1's CommandButton1 button is clicked. Which block of code leaves UserFrom1 loaded but not visible until the FoundErrors function has checked it, and then enables processing to continue if no errors are found?
9. Which cell is selected if you run this code?
'Range('E3:312').Range('B3').Select'
10. Which keyboard shortcut causes VBE to locate the declaration of a procedure?
11. Explicit variable declaration is required. MyVar is declared at both the module and the procedure level. What is the value of MyVar after first AAA() and then BBB() are run?

Dim MyVar As String
Sub AAA()
Dim MyVar As String
MyVar = 'Procedure AAA Scope'
End Sub
Sub BBB()
MyVar = 'Procedure BBB Scope'
End Sub
12. What is needed for the contents of Module1 to be availble to other modules in a VBA project, but not to any other VBA project?
13. A declaration has scope, which has three levels. What are they?
14. Which two sets of values are printed by this function and sub?

Function GetVitals(ID As Long, Age As Long, Optional Weight As Long) As String
GetVitals='ID=' & ID &'Age=' & Age & 'Weight=' & Weight
End Function
Sub ShowVitals()
Dim ID As Long, Age As Long,Weight as Long
Debug.Print GetVitals(ID:=5,Age:=20)
Debug.Print GetVitals(ID:=6,Age:=25,Weight:=130)
End Sub
15. What is the principal difference between a class and an object?
16. This code shows the first statement of CalledSub. Which calling statement will work properly?
'Sub CalledSub(Surname, Age)'
17. How does a class module indicate that it uses a particular interface?
18. Which statement is true?
19. What does this code display?

Sub MakeErrors()
Dim Y As Variant, Z As Variant
On Error Resume Next
Y = 1 / 0
MsgBox 'Y = ' & Y
On Error GoTo 0
Z - (0 - 3) ^ 0.5
MsgBox 'Z = ' & Z
End Sub
20. What is the output?

Sub UseSum()
Dim TestArray() As Integer, Total As Integer
ReDim TestArray(1)
TestArray(1) = 6
ReDim TestArray(2)
TestArray(2) = 3
Total = WorksheetFunction.Sum(TestArray)
End Sub
21. What value does the MsgBox statement display?

Sub MySub(VarA As Long, ParamArray VarB() As Variant)
MsgBox VarB(0)
End Sub
Sub ShowValue()
Call MySub(10, 'First arg', 2, 3.1416)
End Sub
22. When you define a new class of object, where do you assign a name to it?
23. There are two references that must be selected in the Visual Basic Editor in order for any Visual Basic code to run in Excel. What are these two references?
24. What object is needed to put a userform module in a VBA project?
25. A VBA project must declare four classes. How many class modules are needed?