How to Fix Excel VBA 'This Won't Work on Multiple Selections' Error
Question details
The user encounters an intermittent VBA macro error stating 'This won't work on multiple selections' when attempting to add a new worksheet.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Running a VBA macro that retrieves data from an external file and creates temporary worksheets for calculations in a workbook with password-protected sheets.
- Observed behavior
- The macro randomly fails to add a worksheet and throws the multiple selections error, even though no multiple worksheets appear to be manually selected by the user.
Before editing your VBA code, check the top title bar of your application to ensure your worksheets are not accidentally grouped (indicated by the word '[Group]' next to the file name), as this restricts structural changes.
Ungroup Visible and Hidden Worksheets
This error most commonly occurs when multiple worksheets are grouped together, which prevents Excel from adding new sheets via macros.
Even if you only see one active worksheet, hidden sheets might be grouped or selected in the background due to previous macro actions. Ungrouping them will resolve the restriction.
Look at the sheet tabs at the bottom. If multiple tabs are highlighted in a lighter color, they are grouped.
Right-click on any active sheet tab at the bottom of the window and select 'Ungroup Sheets' from the context menu.
Right-click a sheet tab, click 'Unhide', and ensure no hidden sheets are inadvertently remaining in a grouped state.
Add 'ActiveSheet.Select' before the worksheet addition command in your VBA code to ensure only a single worksheet is actively selected when the macro runs.
Verify Workbook and Worksheet Protection
If the workbook structure is protected, adding or modifying worksheets will trigger errors during macro execution.
Isolate the Problem in a Sanitized Copy
Intermittent issues can sometimes be caused by file corruption or conflicts with external data fetching.
Run Macros and Manage Worksheets Smoothly with WPS Spreadsheet
WPS Office provides highly reliable compatibility with Excel macros (VBA). You can safely execute complex data-fetching scripts, auto-generate calculation worksheets, and manage document protection seamlessly.
- 1. Open Your Macro File: Launch WPS Spreadsheet and open your existing .xlsm or .xls workbook.
- 2. Access Developer Tools: Navigate to the 'Developer' tab on the main ribbon to access your VBA environment.
- 3. Run the Script: Click on 'Macros', select the script that generates your temporary worksheets, and click 'Run'.
- 4. Manage Sheet Protection: Go to the 'Review' tab to quickly unprotect workbooks or ungroup sheets before executing complex structural macros.

Frequently Asked Questions
Why does the 'This won't work on multiple selections' error happen intermittently?
Intermittent errors often occur because a previous action in the macro, or a user's manual action beforehand, left multiple worksheets grouped. If the macro doesn't explicitly ungroup or select a single sheet before adding a new one, the error triggers unpredictably based on the previous state.
How do I know if my worksheets are grouped in Excel?
You can tell worksheets are grouped if multiple sheet tabs at the bottom of the window have a solid white or highlighted background. Additionally, the word '[Group]' will appear in the application title bar at the very top of the window next to the file name.
Can workbook protection cause worksheet addition errors in VBA?
Yes. If the workbook structure is protected, macros are blocked from adding, deleting, or moving worksheets. You must unprotect the workbook—either manually via the Review tab or programmatically within the VBA script—before executing the worksheet addition command.
Does WPS Office support Excel VBA macros?
Yes, WPS Office offers excellent support for VBA macros. By enabling the Developer tools in WPS Spreadsheet, you can write, edit, and run macro scripts seamlessly with high compatibility for standard Excel macro files (.xlsm).




