![]() ![]() Click on the Macro name you want to run and press the Run button. ![]() Head to the Developer tab and click on Macros. Make sure you open the workbook that contains the macro you want to run. Here is a spreadsheet that demonstrates this method. Follow these steps to run a macro from the Developer tab: 1. "Hide" cells whose values depend on macros being enabled by setting their text color and background color to be the same. Highlight the check-cell in a bright color, and perhaps change the "macros are disabled" text to include instructions on how to enable macros. You can then apply conditional formatting to do a number of things if macros are disabled: I tested this method extensively, and it seems to very reliably indicate whether macros are enabled or not. ![]() By concatenating NOW(), the current time is read every time the spreadsheet is opened, and so the value of the cell is recalculated. If you just use ISERROR(MacrosEnabled()) the value is not recalculated every time the spreadsheet is opened. Now, in whatever cell you want to display a notice regarding whether macros are enabled or not, enter the following equation: =IF(ISERROR(MacrosEnabled()&NOW()),"Macros are disabled","Macros are enabled") The problem with hiding/unhiding sheets is that the worksheet could be saved in an "enabled" state, be closed without saving, and then be re-opened and not display the warning.Ĭreate the following function in a Module (not a worksheet or workbook macro): Public Function MacrosEnabled() Here is an alternate method to check if VBA is enabled without having to hide/show sheets. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |