Complete the code to start a VBA procedure named MyMacro.
Sub [1]() ' Your code here End Sub
SubThe Sub keyword starts a VBA procedure, and the name follows it. Here, MyMacro is the procedure name.
Complete the code to display a message box with the text "Hello World".
Sub ShowMessage()
[1] "Hello World"
End SubMessageBoxMsgBox is the VBA command to show a message box with a message.
Fix the error in the code to correctly assign the value 10 to cell A1 in the active worksheet.
Sub SetValue()
ActiveSheet.Range("A1").[1] = 10
End SubSet which is a VBA keyword but not a propertyContent which is not a valid propertyText propertyThe Value property sets or returns the value of a cell. This is the correct way to assign a value.
Fill both blanks to create a procedure that loops from 1 to 5 and shows each number in a message box.
Sub ShowNumbers()
Dim i As Integer
For [1] = 1 To 5
MsgBox [2]
Next i
End SubThe loop variable i is declared and used in the For loop and inside the MsgBox to show the current number.
Fill all three blanks to create a procedure that sums numbers from 1 to 10 and shows the result.
Sub SumNumbers()
Dim total As Integer
total = 0
Dim [1] As Integer
For [2] = 1 To 10
total = total + [3]
Next [2]
MsgBox total
End SubThe variable i is declared and used as the loop counter and added to total each time.