How do you stop recording a Macro?

Step 1: Go To Developer tab from the main ribbon of Excel window.

Step 2: Click on ‘Stop Recording’ command button to stop from the recording macro.

How do you run a macro in Excel?

Press the “play” button on the macro toolbar.

Or use the keyboard shortcut “Alt+F8” to open the macro dialog box, where you can then select the macro you want to run. 

What are the steps to follow before beginning with macros?

Go to File > Options > Customise Ribbon. Then, in the Customise the Ribbon section, under Main Tabs, check the Developer check box, and press OK.

How Do You Save an Excel Macro?

When you write a macro, it is saved automatically in the workbook where you wrote it; there is no need to save it separately. However, you must save the workbook in macro format (.xlsm). When you try to save a workbook with a macro in another format, Excel warns you.

How Do You Run a Macro?

You can select a macro from the list and run it. On the Developer tab, there’s a button called macros that, when clicked, displays a dialogue box with a list of macros from all open workbooks.

How to assign values to an array?

We can assign values to an array by:

‘Declare an array variable

Dim aValue (2) As Integer


aValue(1)= “Second”

aValue(2)= “Third”


Dim aValue () As Integer={” first “,”Second”,”Third”}

How to add UserFrom to a VBA Project?

Step 1: In the VBA Editor window, navigate to the Insert menu.

Step 2: Select ‘UserForm to Add to Project’. In the Project Explorer, you can now see the newly added UserForm. The default UserForm name is ‘UserForm1’. You can change the name of the UserForm by using properties.

What are variables in Excel VBA used for?

Variables are used to store data that can be referenced throughout the code. Text strings, numbers, and objects are examples of this. This information can be easily accessed and used later in the code by storing it in a variable. This makes coding much simpler and more efficient.

How can you stop a VBA script when it goes into the infinite loop?

By Ctrl+ Pause Break, key one can discontinue VBA script when it goes into an infinite loop

Explain how to debug a VBA code?

To debug a VBA code, follow the steps

Using Breakpoints (F9)

Step by step execution (F8)

Print & Immediate Window and Watch the window

How does “reference counting” work in VBA?

When a variable exits scope in VBA, the reference counter on the reference object is decremented. The reference counter is incremented when you assign the object reference to another variable. When your reference count reaches zero, the event is terminated.

Why are UserForms used and how ?

For complex user input, userforms should be used. When using non-text as an input in an application, it is recommended to use Userforms rather than input boxes. When we use Userforms, a user can provide input an unlimited number of times, which is not the case when we use input boxes. This is accessed via the insert menu in your VBA editor, where you can then insert your code.

What is the comment style in VBA?

Comments are used to document the programme logic and user information so that future programmers can work seamlessly on the same code. In VBA, there are primarily two ways to represent comments.

1.) Any statement that begins with a single quotation mark is considered a comment.

2.) Alternatively, you can use the statement REM instead of the single quotation mark (‘).

Explain what is VBA or Visual Basic for Applications?

VBA stands for Visual Basic for Applications; it is an event driven programming language developed by Microsoft. It is predominantly used with Microsoft office applications like MS-word, MS-Access, and MS-Excel.

Where can you write your VBA program for Macro?

Module is the place where you can write VBA program for Macro, to insert a Module navigate to Insert ->Module

How can you pass arguments to VBA functions?

ByVal: If an argument is supplied to a procedure by Value rather than by the argument itself, then the procedure will only get the value passed, and any modifications made to the argument inside the procedure will be lost when the procedure exits.

ByRef: The actual address of the argument is supplied to the procedure when the argument is passed by reference. When the process is ended, any modifications made to the argument inside it will be recalled.