While trying to edit a Macro, a notification box is displayed:
The Macro is not in the active workbook, it’s in a different workbook that is hidden (PERSONAL.xlsb here).
Solution 1 – Editing a Macro on a Hidden Workbook by Unhiding It
Step 1: Opening the Unhide Dialog Box in the View Tab
- Go to the View tab.
- In Windows, click Unhide.
Step 2: Unhiding the Workbook in the Dialog Box
- In the Unhide dialog box, select the hidden workbook (PERSONAL.xlsb).
- Click OK.
Step 3: Editing the Macro
To edit the Macro:
- Go to the Developer tab.
- Click Macros in Code.
- Select your Macro and click Edit.
You can edit it.
Read More: [Fixed!]: Unable to Enable Macros in Excel
Solution 2 – Editing a Macro in a Hidden Workbook Using a VBA Code
VBA Code:
Sub Edit_a_Macro_on_a_Hidden_Workbook()
Hidden_Workbook_Name = "PERSONAL.XLSB"
Hidden_Macro_Name = "Macro1"
Active_Workbook_Name = "Cannot Edit a Macro on a Hidden Workbook.xlsm"
Windows(Hidden_Workbook_Name).Visible = True
Windows(Active_Workbook_Name).Activate
Application.Goto Reference:=Hidden_Workbook_Name + "!" + Hidden_Macro_Name
End Sub
Notes:
The hidden workbook is “PERSONAL.XLSB”, the hidden Macro is “Macro1”, and the workbook is “Cannot Edit a Macro on a Hidden Workbook.xlsm” (here).
Output:
- Run the code by clicking Run Sub / UserForm.
The workbook will be unhidden and the editor window will be displayed.
Download Practice Workbook
Download the practice workbook.
Related Articles
- Excel Macro Security
- [Solved]: Macro Settings Greyed out in Excel
- [Fixed!] Macros Not Working in Excel
- [Fixed] Excel Macros Enabled But Not Working