How to View VBA or Macro code in an Excel file?
You will be able to view VBA code written within a Excel file using any of these 3 different methods.
1. Keyboard Shortcut:
> Alt + F11
This is the most used & quick method to view the VBA code in a Excel. 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.
2. Developer Tab:
> 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 Code:
> 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.