How to Insert and Run VBA Code in Excel?
In Excel VBA stands for (Visual Basic for Application Code) where we can automate our task with help of codes and codes that will manipulate(like inserting, creating, or deleting a row, column, or graph) the data in a worksheet or workbook. With the help of VBA, we can also automate the task in excel to perform all these tasks we need to insert and run the VBA code properly which we will discuss in this article.
Steps to Insert and Run VBA Code in Excel
To use the VBA code properly in Excel we need to change the default macro security settings of excel for that we need to follow further steps
Step 1: Click on the âFileâ menu at the left top of the excel tab.
Step 2: Select âOptionsâ to get the âExcel Optionsâ window.
Step 3: Select âCustomized Ribbonâ in the âExcel Optionsâ Window and then select the âDeveloperâ check box in the âMain Tabsâ.
Step 4: Then return to the main Excel window to select the âDeveloperâ ribbon and then click on âMacro Securityâ in the âCodeâ group.
Step 5: Click on âMacro Settingsâ to select âDisable all macros except digitally signed macrosâ.
Now, to insert and run the VBA in Excel so that we can write codes we need to follow further steps:
Step 1: In the main Excel window press âAlt + F11â to open Visual Basic Editor
Step 2: Select âSheet1(Sheet1)â in the âProject â VBAProjectâ tab.
Then we will get a terminal where we can write the following code,
Step 4: After writing a piece of code according to the userâs need we need to press âF5â to run the code and then click on âRunâ in the âMacroâ Tab
Then, the output of the code will be seen in the Excel sheet.
Contact Us