Fix Excel Cannot Edit a Macro on a Hidden Workbook Error – Easy Tutorial

In Microsoft Excel, macros are excellent tools that can automate repetitive tasks, save time, and increase efficiency. However, working with Excel macros isn’t always smooth sailing. One of the common stumbling blocks users encounter is the “Cannot edit a macro on a hidden workbook. unhide the workbook using the unhide command” error. This warning can be frustrating, but don’t worry! We’ll walk you through why this happens and, more importantly, how to fix it.

cannot edit a macro on a hidden workbook

To fix Excel file corruption, we recommend this tool:

This software will prevent Excel workbook data such as BI data, financial reports & other analytical information from corruption and data loss. With this software you can rebuild corrupt Excel files and restore every single visual representation & dataset to its original, intact state in 3 easy steps:

  1. Try Excel File Repair Tool rated Excellent by Softpedia, Softonic & CNET.
  2. Select the corrupt Excel file (XLS, XLSX) & click Repair to initiate the repair process.
  3. Preview the repaired files and click Save File to save the files at desired location.

What Does Cannot Edit a Macro on A Hidden Workbook Mean?

When MS Excel displays the ‘cannot edit a macro on hidden workbook’ error, it means that you can’t make changes or modifications to a macro because the workbook is hidden.

Why It Occurs?

However, this can occur due to a wide variety of reasons, including:

  1. The Excel workbook is corrupted.
  2. Upgraded Excel application to the latest version and thus few of its functions aren’t supported as per your PC’s configuration.
  3. Faulty Excel add-ins may obstruct you from editing its macro.
  4. The document is saved in xlsx format instead of xlsm.
  5. Your PC’s security setting is hindering the running of your Excel macros.

How to Fix Excel Cannot Edit Macro on A Hidden Workbook Error?

Here are possible fixes to troubleshoot this error:

So just go through them one by one…!

Way 1- Unhide the Hidden Workbook

Unhiding the workbook or worksheet is the crucial step to overcome this situation. Here are the steps that you need to perform unhiding the workbook for editing macro.

  • At first go to the Excel Ribbon.
  • After that from the menu bar hit the View tab.

Modify Page Layout View

  • Tap to the Windows Group and >> the Unhide option.
  • This will open a window in which you will see the entire list of hidden workbooks which are open.
  • Now select the workbook which you want to unhide and hit the OK button.

If no password is applied on your Excel workbook, then it will get open unhidden immediately. Or else, you have to feed the password first.

After this, when you try to edit the macro in a hidden workbook then it won’t show any error this time.

Also Read: Fixed- Microsoft Has Blocked Macros from Running Excel!

Way 2- Disable The Add-Ins to Fix Excel Cannot Edit a Macro on a Hidden Workbook Error 

If add-ins are present in your Excel file then this can also be the reason behind the inability to edit the macro in a hidden workbook. So try to edit Excel macros after disabling them once and check whether you are getting the same error message this time.

Here are the steps to disable add-ins in Excel:

  • Hit the File> Options> Add-ins.
  • Now in the Excel option window, select the COM Add-ins from your drop-down menu and hit the Go button.

COM Add-ins

  • Unselect all the checkboxes and hit the OK button.

Inquire add-in

  • Restart your Excel application and check whether the issue has been resolved or not.

Way 3- Unhide The PERSONAL.Xlsb File

Mostly it is seen that the user fails to fetch and unhide this PERSONAL.xlsb file in the Excel application. In that case, you can look for this file in the File Explorer.

Usually, this file is found in the following location:

C:\Users\UserName\AppData\Roaming\Microsoft\Excel\PERSONAL

  • Make a right click on the personal name folder. Now from the menu choose the properties option.
  • Just un-tick the hidden property and tap on the OK button.
  • Now Internet Explorers make confirmation whether you want to apply your done changes to the sub files and folders or only to the folder.
  • Make a selection as per your requirement and then hit the ok.

After this, you will see that all the files within that specific folder are no longer hidden now. Besides that, you can also edit/delete macros present within them.

Way 4- Save The Document In XLSM Format

If you are frequently getting this cannot edit a macro on a hidden workbook. unhide the workbook using the unhide command, the very first thing that you need to figure out is the location where Excel macros are been saved.

If your macros are saved in the document then ensure that you save it in xlsm file format. This is because if you save it in the xlsx file format then macros will get removed from it.  But if it is saved in the XLSM file format then you will be able to edit your macros anytime.

In case, macros are not kept in the template instead of the document section then you have to load your template directly and then save it back again by using a macro-enabled template.

After doing this, you can easily modify your macros within the template.

Also Read: Fix Personal Macro Workbook Not Opening

Way 5- Modify Trust Center Security Settings

Sometimes your PC’s security setting hinders you from editing the macros in a hidden workbook. So this issue can easily be resolved from the trust center. Here are the steps that you need to follow:

  • Hit on the File
  • Tap to the Options.
  • Now hit on the Trust Center, and then tap to the Trust Center Settings.

Trust Center Settings

  • From the Trust Center, tap to the Macro Settings.
  • Hit the option ”Enable All Macros”.
  • Tap to the OK button.

Enable all macros

This time when you open your Excel document, you can easily perform your macros editing.

Note: doing this will allow all the macros to run on your PC. So if you are pretty much sure that you won’t open any malicious code containing documents, then it’s fine. Otherwise, rerun the above step and choose the first option i.e. disable all macros with notifications.

This time when you try to edit or delete your macro from the workbook you will not get any error.

Way 6- Repair Corrupt Excel Workbook

If none of the above solutions worked in resolving this error, it means your Excel workbook has somehow got corrupted. So, you need to repair it immediately. After that only you will be able to regain access to your Excel macros. Just to cut down your extra time and effort of searching for such a reliable tool I have a well-rounded solution i.e. Excel Repair & Recovery tool.

  • Very easily repair and recover corrupt Excel files.
  • Well compatible for both Windows and Mac PCs.
  • Easy options to find and select damaged/corrupted Excel XLS/XLSX files.
  • The software can fix any issue that is infecting your Excel file.
Try Now       Buy Now
* Free version of the product only previews recoverable data.

Using the Free trial version of this tool, you can only see the preview of all your recoverable items. After the complete assurance, you can buy this tool and save your repaired Excel files.

Related FAQs:

Can You Edit an Existing Macro?

Yes, you can edit an existing macro. For this, navigate to Developer tab, under the Code group, simply click Macros. Under the Macro name box, you have to click the macro that you need to edit. Now, click Edit.

How to Unhide a Workbook Using the Unhide Command?

To unhide a workbook, you have to:

  • Open a specific Excel workbook which you need to unhide.
  • Go to the View tab and choose Unhide Workbook from the menu.
  • The Excel workbook will be visible again.

What Is the Shortcut for Unhide in Excel Workbook?

To unhide in Excel workbook, you have to press the keyboard shortcut Alt+W+U.

Also Read: Unveiled: Solving “Excel File Locked for Editing” Error

Time to Say Goodbye

Fixing Excel cannot edit a macro on a hidden workbook error may seem daunting, but with the right steps, it’s manageable. By understanding the causes and applying the solutions provided above in this blog, you can get back to editing your macros in no time.

I hope you have found this tutorial helpful. If you are facing any other issue related to this specific one, share your experience on our social media FB and Twitter Page.



Priyanka is a content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.