The Excel VBA Environment
- 05:24
Accessing the Excel VBA environment and the windows in Excel VBA.
Downloads
No associated resources to download.
Transcript
The Excel VBA programming environment is not directly available to us in the main Excel application.
In order to get to the Excel VBA environment, we must enable the developer ribbon.
This is done by selecting the file menu option from the ribbon, and then choosing options from the options menu.
Select customized ribbon and tick the checkbox next to the developer in the main tabs window.
Once that's been done, press okay.
In the main Excel window, a new menu option is now available in the ribbon.
The developer menu, the developer tab, provides us with a door to the Excel VBA environment.
Let's explore some of the key commands in the developer tab.
Visual basic, this button will take us to the Visual Basic Editor window in Excel VBA View macros.
You will hear the word macro used regularly in relation to Excel VBA.
We can think of a macro as a program written in VBA code.
A macro is a set of instructions in VBA code to perform specific actions.
This button provides a list of all our Excel VBA macros or programs record macro.
The record macro button allows us to record a series of actions, keystrokes and commands in the front end of Excel and turn this into VBA code.
If we click the visual basic button, we are taken to the Visual Basic Editor window.
Even though the Visual Basic Editor window is displayed, the main Excel window is still open.
The Visual Basic Editor window is where we can write, edit, and test our Excel VBA code.
Let's take a look at the four windows in the Excel Visual Basic Editor.
Firstly, the code window, this is where we can view and write the Excel VBA code.
The VBA code is written within a procedure and the procedures can be grouped together into modules.
The Project Explorer Window, this is where we can see each of the elements of our VBA project.
We can see a list of all of our modules, the properties window.
This displays the properties for the item currently highlighted in the Project Explorer window.
And finally, the immediate window.
This can be used to test statements in our VBA code.
Of course, we want to be as efficient as possible when using the Visual Basic Editor and using the macro recording function.
And there are a number of keyboard shortcuts that can help ALT L and R will toggle between starting and stopping.
The macro recorder in the front end of Excel ALT and F 8 will bring up a list of all of the macros available in that project.
ALT F 11 will open the Visual Basic Editor window.
In the Visual Basic Editor window pressing control and R will activate the Project Explorer window.
The F 4 shortcut key will activate the properties, window control and G will activate the immediate window.
And finally, control and Tab performs a similar function to that that we have in the front end of Excel, and it will switch between open windows.