Be the first user to complete this post

  • 0
Add to List

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:

  1. Project Window
  2. Code Window
  3. 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)
Excel-VBA -Project and Property Window - 1
Excel-VBA -Project and Property window shortcuts - 1

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”).

Project Window:

Now if you observe at Project Explorer, you can see you VBAProject(“Book1”), yes that’s your excel workbook.

Excel-VBA - Project Window -2
Excel-VBA - Project Window -2

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”

Excel-Macro - Code Window-3
Excel-Macro - Code Window-3

Change the WorkSheet Name:

Go back to Excel and change the name of the sheet

Excel Macro -Change Sheet Name-4
Excel Macro -Change Sheet Name-4

You can double click on “Sheet1” and change the name or right click on “Sheet1” and select Rename and enter the new name

Excel Macro - Change Sheet Name-5
Excel Macro - Change Sheet Name-5

And now if you notice the Project Window

Excel Macro - Change Sheet Name-6
Excel Macro - Change Sheet Name-6

 Project Window:

Now if you observe at Project Explorer, you can see you VBAProject(“Book1”), yes that’s you Excel workbook.



Also Read:

  1. VBA-Excel: Open a Excel WorkBook
  2. WorkBooks and WorkSheets
  3. VBA-Excel: Create or Add Worksheets at the Run time.
  4. VBA-Excel: Copy/Paste data - Copy the Entire row data and paste it to another row