I Cannot Get VBA to Run in Excel
- While VBA programmers sometimes run macros from the VBA programming environment linked to Excel, most users run macros from the "Developer" tab. If you don't see that tab, expose it with Excel's "Options" menu. Click the "File" menu's "Options" command, then click the "Customize ribbon" control from the "Categories" pane. Click the "Developer" checkbox to display the "Developer" tab, then click "OK" on all open dialog boxes.
- You won't be able to run any VBA programs if Excel's security settings don't allow it. Microsoft made it possible for users to lock out macros from execution because these programs can potentially perform malicious operations. Allow macros to run by first clicking the "Options" item from the "File" menu, then clicking the "Trust center link." Click "Trust center settings," followed by "Macro settings," and then click "Enable all." Close all open dialog boxes by clicking their "OK" buttons, then close and reopen Excel for your changes to take effect.
- Starting with Excel 2007, macros can only be stored in specific file types, those with the ".xlsm" and ".xltm" extensions. These are not the default formats for Excel; you must choose them explicitly. If you're looking for a macro in one of the default formats, ".xlsx" or ".xltx," you won't find it, as these formats can't store macros. Seek a macro to run in an ".xlsm" or ".xltm" file.
- Once you've configured your security settings to allow macros and loaded a workbook with at least one macro, you're ready to run a macro with Excel's "Macros" command. Click that command's button from the "Developer" tab to tell Excel to display a list of macros in the current workbook. Double- click one of the macros from the list to run the macro.
Expose the Developer Tab
Change Security Settings
Load a Workbook with Macros
Run a Macro
Source...