How to open VBA code or Macro code in an Excel file?
You will be able to open VBA (Visual Basic for Applications) code written within a Excel file using any of these 3 different methods.
1. Keyboard Shortcut to open vba code
This is the most used & quick method to view the VBA code in a Excel.
- Press Alt + F11
Open any Excel file with extension .xlsm or xlsb. If the File has any macro code then it will be displayed in the VBA editor for MS Office.
This methods works in Windows operating system only.
2. Developer Tab – open VBA code in Excel
Here is the menu navigation to open vba code from Excel or any Ms Office application.
- Menu -> Deverloper Tab -> Visual Basic
This menu option is not enabled by default in few machines.
It can be enabled by using the option mentioned in this page.Once it is enabled, the options will be displayed in Excel menu after the view tab.
Apart from viewing the VBA code, this option also has other useful function like record macro, macro security, Addins, User controls etc.,
3. View VBA code from Worksheet Tab
Use these steps to open vba code right from your worksheet tabs visible at the bottom of Excel workbook.
- Right click on worksheet Tab -> View Code
This is also a straight forward method to view VBA code.At botton left hand side of every Excel workbook, you will be able to see different tabs available like Sheet1, Sheet2 etc.,
Place mouse cursor in here and right click. Then You should be able to find this option -> View Code.
All these three functions does the same thing. It opens up the Visual basic environment for MS Office applications. If there is any macro code present in the Excel file, then you should be able to see the code in any of the sheets, modules, class modules or forms.
If it is just a plain Excel file, then there wont be any code present. You should be able to see only a blank project.