VBA & Macro Problems

Fix Excel Closes When Running a Worksheet Visibility Macro

Jason MillerJason Miller Nov 2, 2026 869 views

Question details

Excel closes unexpectedly for certain users when executing a macro designed to hide or unhide worksheets in a shared workbook.

How to Fix Excel Closing When Running a Worksheet Visibility Macro
Product
Microsoft Excel
Device & OS
not provided
Scenario
Running a VBA macro to change worksheet visibility, calculation mode, and screen updating in a workbook stored on a shared server.
Observed behavior
The application crashes or closes completely for specific users, while functioning normally for others using the exact same file.
Before you start

Verify your network connection to the shared server and confirm that no other users currently have the file locked for editing.

Solution 1Recommended

Repair Microsoft Office and Verify Local Environments

Since the macro successfully runs for some users, the crash is likely caused by a corrupted local Office installation, version mismatch, or permission issue rather than the VBA code itself.

When a shared workbook works flawlessly for one group of users but crashes for another, the problem generally lies in the local environment. Differences in Microsoft 365 update channels or minor corruptions in the Office installation can cause sudden crashes during memory-intensive VBA operations.

1
Run an Online Office Repair

Open the Windows Control Panel, navigate to 'Programs and Features', select your Microsoft Office or Microsoft 365 installation, click 'Change', and choose 'Online Repair'.

2
Test the Workbook Locally

Copy the macro-enabled workbook from the shared server directly to the affected user's local desktop. Run the macro to determine if network latency or server permissions are triggering the crash.

3
Compare Excel Versions

Open Excel, go to File > Account, and check the exact version and build number. Ensure that the users experiencing crashes are on the same update channel as the users who can run the macro successfully.

Repair Microsoft Office and Verify Local Environments
Administrator Privileges Needed: Running an Online Repair for Microsoft Office requires administrative privileges on the affected user's computer.
Free Microsoft Office alternative

Switch to WPS Office for a Stable Spreadsheet Experience

If Excel continues to crash when handling shared workbooks or running complex scripts, consider trying WPS Office. It provides a lightweight, highly compatible, and stable environment for managing heavy spreadsheets without the frequent crashes.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package.
  2. 2. Install and Launch: Follow the on-screen instructions to install the software, then open WPS Spreadsheets.
  3. 3. Open Your Spreadsheet: Click 'Open' and select your existing Excel file to continue working smoothly without formatting loss.
Highly compatible with Microsoft Excel (.xlsx, .xls) filesLightweight application that requires fewer system resources, reducing crash risksFamiliar user interface ensuring a seamless migrationFree to use with comprehensive spreadsheet capabilities
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel macro only crash for certain users?

This discrepancy usually happens due to differences in local Excel versions, corrupted Office installations, or mismatched network permissions to the shared server where the workbook is hosted.

Can changing Application.ScreenUpdating cause Excel to close?

While rare, toggling Application.ScreenUpdating or Application.Calculation in a complex macro over a slow network connection can occasionally trigger an application fault or memory crash. Commenting out these lines can help diagnose the issue.

How do I test if the shared server is causing the macro to fail?

Simply copy the macro-enabled workbook from the network drive to your local hard drive. If the macro runs without closing Excel locally, the issue is directly related to network latency or server security restrictions.