- VBA - Userforms
- VBA - Programming Charts
- VBA - Text Files
- VBA - Excel Objects
- VBA - Error Handling
- VBA - Events
- VBA - Sub Procedure
- VBA - Functions
- VBA - Arrays
- VBA - Date and Time
- VBA - Strings
- VBA - Loops
- VBA - Decisions
- VBA - Operators
- VBA - Constants
- VBA - Variables
- VBA - Input Box
- VBA - Message Box
- VBA - Macro Comments
- VBA - Excel Terms
- VBA - Excel Macros
- VBA - Overview
- VBA - Home
VBA Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
VBA - Excel Macros
In this chapter, you will learn how to write a simple macro in a step by step manner.
Step 1 − First, enable Developer menu in Excel 20XX. To do the same, cpck File → Options.
Step 2 − Cpck ‘Customize the Ribbon’ tab and check Developer . Cpck OK .
Step 3 − The Developer ribbon appears in the menu bar.
Step 4 − Cpck the Visual Basic button to open the VBA Editor.
Step 5 − Start scripting by adding a button. Cpck Insert → Select the button.
Step 6 − Perform a right-cpck and choose properties .
Step 7 − Edit the name and caption as shown in the following screenshot.
Step 8 − Now double-cpck the button and the sub-procedure outpne will be displayed as shown in the following screenshot.
Step 9 − Start coding by simply adding a message.
Private Sub say_helloworld_Cpck() MsgBox "Hi" End Sub
Step 10 − Cpck the button to execute the sub-procedure. The output of the sub-procedure is shown in the following screenshot. Make sure that you do have design mode turned on. Simply cpck it to turn it on if it is not on.
Note − In further chapters, we will demonstrate using a simple button, as explained from step#1 to 10. Hence , it is important to understand this chapter thoroughly.
Advertisements