Office for Mac Issues

How to Fix Excel VBA Sheet Errors for XLSB Workbooks on Mac

Algirdas JasaitisAlgirdas Jasaitis Nov 2, 2026 869 views

Question details

The user is encountering application-defined errors (such as Error 40036) when attempting to access or delete the sixth or later worksheet in an XLSB workbook using VBA on a Mac.

How to Fix Excel VBA Sheet Errors for XLSB Workbooks on Mac
Product
Microsoft Excel for Mac
Device & OS
macOS
Scenario
Running a VBA macro to delete or manipulate specific worksheets (e.g., Sheet 'F') within an XLSB (Excel Binary Workbook) file.
Observed behavior
Excel for Mac throws an error and fails to execute the VBA code on the targeted worksheet, despite the syntax being correct, indicating potential workbook corruption or path issues.
Before you start

Create a secure backup copy of your XLSB workbook to a different folder to prevent any accidental data loss while troubleshooting corruption and testing VBA macros.

Solution 1Recommended

Rename the Problematic Worksheet and Restart Excel

This method forces Excel to rebuild its internal metadata and references for the specific worksheet, bypassing temporary glitches or minor corruption.

Often, VBA errors such as Error 40036 occur not because of incorrect code, but because Excel's internal reference to that specific sheet has become corrupted. Renaming the sheet and restarting the application completely can clear out the cached error state.

1
Rename the worksheet

Double-click the tab of the problematic worksheet (e.g., Sheet 'F') at the bottom of the window, type a temporary new name, and press Enter.

2
Save the workbook

Click 'File' in the top menu bar and select 'Save' to apply the new worksheet name to the file.

3
Quit Excel completely

Press Command-Q on your Mac keyboard to completely quit Microsoft Excel, ensuring the application does not remain running in the background.

4
Reopen and revert the name

Relaunch Excel, open your XLSB workbook, double-click the renamed sheet tab, and change the name back to its original title before running your macro again.

Rename the Problematic Worksheet and Restart Excel
Test with the Macro Recorder: You can verify this fix by turning on the Macro Recorder, deleting the sheet manually, and then reviewing the recorded code to ensure Excel now recognizes the action without errors.
Free Microsoft Office alternative

Try WPS Office for Seamless Spreadsheet Management on Mac

If you continue to encounter persistent VBA errors or corrupted workbooks in Microsoft Excel for Mac, switching to WPS Office provides a stable, free, and lightweight alternative. It offers a familiar interface that makes spreadsheet management and data migration effortless.

  1. 1. Download and install: Download WPS Office for Mac from the official website and complete the quick installation process.
  2. 2. Open your spreadsheet: Launch WPS Spreadsheets and open your existing .xlsb or .xlsx file directly without any format conversion.
  3. 3. Manage your worksheets: Easily add, delete, and manipulate worksheets using a stable platform that prevents common metadata corruption issues.
Highly compatible with Microsoft Excel formats including .xlsx, .xls, and .xlsb filesAvoid complex VBA errors with built-in, easy-to-use advanced data analysis toolsLightweight architecture ensures fast and responsive performance on macOSFree to use with a familiar UI, allowing for seamless transition from MS Office
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel VBA macro return Error 40036 when deleting a worksheet?

Error 40036 is an application-defined or object-defined error. On Excel for Mac, it frequently happens when the workbook's metadata is corrupted, or the worksheet object cannot be found due to broken internal references or unsupported characters in the file's directory path.

How can I tell if the issue is a VBA syntax error or workbook corruption?

You can isolate the issue by creating a brand-new test workbook with the exact same sheet names (e.g., a sheet named 'F'). Run your deletion macro on this new file. If the macro works perfectly, your code syntax is correct, and the issue lies in the corruption of the original workbook.

Does saving an XLSB file as an XLSM fix VBA worksheet errors?

It can. The XLSB (Excel Binary Workbook) format stores data differently than XML-based formats. Saving the file as an XLSM (Excel Macro-Enabled Workbook) forces Excel to rewrite the file structure, which can occasionally strip away the corruption causing the worksheet access errors.