Developer Tab in Excel
Let us deep dive and go through the “Developer” tab’s various options.
How to Add Developer Tab in Excel?
How to write VBA Programs using Developer Tab?
We can use the “Developer Tab” in Excel to write VBA programs, as shown below:
- We must open a new Excel sheet and navigate the “File” tab. Then, Go to the “Options.” After clicking on “Options,” we must select “Customize Ribbon” from the left. Next, select “Main Tabs” on the right, then check on the “Developer” checkbox and click on the “OK” button. As a result, the “Developer” tab would appear in the Excel file.
Example #1 – Writing a Simple Code for Displaying “Hi, Welcome to VBA”
We must navigate the “Developer” tab and select “Visual Basic.” A new window will pop up.
Then, we need to double click on “Sheet1 (Sheet1),” and a blank document or pane will appear on the right side.
After that, we must write the following code and click on the “Run” button. A pop-up box would appear saying, “Hi, Welcome to VBA.”
Code Explanation:
Sub and End Sub are used as procedures or, say, the main body of the program.
“Msgbox” is a functional feature in the VBA package which displays whatever is written in it here, for example (“Hi, Welcome to VBA”).
For saving the above code, save it as a .xlsm file so that the macro code gets saved.
Example #2 – Click on Button Feature
This particular feature enables anyone to run the code with the click of a button. For better understanding, let us have an illustration where a person dynamically enters their name and birthplace, which would be displayed as an output.
Then, we must go to the “Developer” tab and click on the Radio buttons in excelRadio Buttons In ExcelIn Excel, radio buttons or options buttons record a user’s input. They can be found in the developer’s tab’s insert section. read more and select “Button (Form Control).”
Now, drag it anywhere in the form, and the following dialog box will appear and rename the “Macro name.”
Click on the “New” button, and the following code page will appear.
Coding part and Explanation
- “Dim” function is used for declaring the variable, which can be the string, numeric, etc.(Here, name and birthplace are variables declared as string)“InputBox” is a functional feature in VBA wherein the user is asked for input.“Msgbox” is the functional feature in the VBA package, which displays whatever is written in it.
Now close the code page window.
Then, we must right-click on the button and select “Edit Text” in the Excel where one had created the button and rename it to “Name_Birth.”
Click on the button and enter the name and birthplace.
Two prompts would pop up for name and birth (enter the name and birthplace, e.g., Dhrish and Pune).
After inserting the name, the following output would appear.
Now, save the file as the “.xlsm” file.
How to Record a Macro in Developer Tab?
It is best suited when one has to do a task repetitively and wants to save time on both the repetitive work and coding.
So, here is the earlier example that we took earlier. Suppose one wants to color columns with formulae for every file. So, we can record the work by doing it first manually and then run it for other files.
Suppose we have data as below.
So, here we have to color yellow on columns F, G, and row total as yellow as formula columns and rows.
So before coloring those yellow, we must go to the “Developer” tab.
Then, click on Record Macro in ExcelRecord Macro In ExcelRecording macros is a method whereby excel stores the tasks performed by the user. Every time a macro is run, these exact actions are performed automatically. Macros are created in either the View tab (under the “macros” drop-down) or the Developer tab of Excel. read more
Once we click on “Record Macro,” a dialog box will appear to rename it to “Color_Yellow.”
Now, color columns F, G, and row total as “Yellow.”
After the coloring, we must go to the “Developer” tab.
Click “Stop Recording.”
Go to the “Developer” tab in Excel and “Visual Basic.”
And select “Module1.”
Next time, if we want to repeat the task, we can click on the (“Run Macro”) button by copying and pasting the same code in the new Excel sheet by using the link. Writing a simple code for displaying.
How to ensure Macro Security using Developer Tab?
We can enable password-protected macros if needed.
We need to first go to the “Developer” tab.
Then, open “Visual Basic.”
Open the “Macro” for which code needs enabling of the password (e.g., we take the Color_Yellow macro as in the above example).
We need to select “Tools” and “VBAProject Properties.”
Subsequently, a dialog box will appear.
First, we must select the “Protection” tab.
Check on the “Lock project” for viewing.
Please enter the password per need, confirm it, and click “OK.”
After that, save it as a .xlsm file while saving and closing it.
Open the file and repeat steps 1,2 and 3.
As a result, it may ask for a password and insert the password.
Now, we can see the code.
Things to Remember
- It is a built-in tab in Excel.It is easy to automate everything with the use of recording the macro.The best part about this is run-time prompts, or the user prompts, which can be given by clicking the button in VBA.We can also create forms or basic UI in VBA. Please refer to references for the same.
Recommended Articles
This article has been a guide to the Developer Tab in Excel. Here, we discuss adding and using the Excel “Developers” tab to write codes in VBA, recording macro, security, and practical examples and downloadable templates. You may learn more about Excel from the following articles: –
- VBA InputBoxCheckbox in ExcelCreate a Checklist In Excel