What is Excel VBA

Microsoft Visual Basic for Applications (VBA) is a computer progarmming language based on Microsoft Visual Basic. It is actually part of MS Office, although not many users are aware of it. MS Office installs a language called Microsoft Visual Basic or simply Visual Basic for Aplications. VBA allows the user to enhance Excel beyond its default function, With VBA you can write code that can automatically perform actions on a document and/or its content. When using that language, you write pieces of code, using an external environment - the VBA Editor

Microsoft Visual Basic is a programming environment that is automatically installed when you setup Microsoft Excel. It stays apart because most people would not need or use it. This means that, if you want to use the Microsoft Visual Basic programming environment that ships with Microsoft Excel, you must ask for it, which can be easily done.

If you've never used macros before your copy of Excel may have macros turned off, even for .xlsm file types. To check, use the keyboard sequence ALT+T, M, S to get to macro settings in the Trust Center dialog box. If Disable All Macros without Notification is selected then choose Disable All Macros with Notification instead. If you use this option, Excel prompts you to enable macros each time you open a file that has them and this is the safest setting if you want to use macros in your workbooks.


Excel Developer Tab Excel Options Dialog

Launching Microsoft Visual Basic in Excel

To write code, you must open Microsoft Visual Basic. There are various ways you can do this.

In the newer versions of Excel since Excel 2007, you should add a new tab, the Developer tab, to the Ribbon. To do this, you can click the Office Button or File and click Excel Options. In the Excel Options dialog box, click the Show Developer tab in the Ribbon check box and click OK. The Ribbon will become equipped with a new tab. To launch Microsoft Visual Basic, from the Developer tab you can click the Visual Basic button.

In earlier versions of Excel you can  launch the Visual Basic Editor in Excel 2003  by clicking on View Code from the Control Toolbox or select the Tools menu, choose Macros and then Visual Basic Editor.

In all versions you can use Alt + F11 to open the Visual basic Editor

 © Roy Cox 2005 to 2013

Our Privacy & Cookie Policy

Introduction to Visual Basic for Applications (VBA)