Excel Macro – Visual Basic Editor
The first question will be where do we write the code , Open the Excel and then press “Alt+F11” and you will get the another window named as “Microsoft Visual Basic” and press “Alt+F11” and you will get back to Excel window.
VBA Editor has 3 main windows:
- Project Window
- Code Window
- Properties Window
Project window and Properties window generally appears on the left side of the Editor. You can close them any time you want and to get them back all you need to do is
- For Project Window : View-> Project Explorer ( Shortcut : Ctrl+R)
- For Properties Window : View->Properties Window ( Shortcut : F4)
You can customize the location of these windows just by click+Hold+drag on the header of the window, Just make sure that its Dockable property is Checked ( right click on the header of of the window and Check “Dockable”).
Now if you observe at Project Explorer, you can see you VBAProject(“Book1”), yes that’s your excel workbook.
Expand VBAProject(“Book1”) -> Expand Microsoft Excel Objects -> Double Click “Sheet1(Sheet1)” and you will white screen appeared on the right side and this white screen is called “Code Window”
Change the WorkSheet Name:
Go back to Excel and change the name of the sheet
You can double click on “Sheet1” and change the name or right click on “Sheet1” and select Rename and enter the new name
And now if you notice the Project Window
Now if you observe at Project Explorer, you can see you VBAProject(“Book1”), yes that’s you Excel workbook.