How to Preserve Excel Slicer Multi-Select Settings with VBA
Question details
The user needs a method to automatically enable the slicer multi-select button whenever an Excel workbook is opened.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Reopening an Excel workbook that contains data slicers with multi-select enabled.
- Observed behavior
- The slicer multi-select button becomes disabled automatically after the workbook is saved and reopened, failing to preserve the user's previous UI state.
Ensure that your workbook contains at least one slicer and that you have the Developer tab enabled in your ribbon to insert VBA macros.
Use a VBA Auto_Open Macro to Enable Multi-Select
Since Excel does not natively preserve the multi-select state of a slicer upon reopening, you can use an Auto_Open macro to automatically select the slicer and trigger the multi-select toggle keyboard shortcut.
This solution utilizes the Auto_Open subroutine, which runs automatically every time the workbook is opened. By simulating the Alt+S keystroke (which triggers the multi-select option on an active slicer), the slicer is set to your preferred state without manual intervention.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer pane on the left, right-click on your workbook name, select 'Insert', and then click 'Module'.
Copy and paste the following code into the blank module window: Sub Auto_Open() ActiveSheet.Shapes.Range(Array("State")).Select SendKeys "%s" End Sub
Go to File > Save As, and ensure you save the file as an Excel Macro-Enabled Workbook (*.xlsm) so the code runs the next time you open it.

Easily Handle VBA Macros and Excel Slicers in WPS Office
WPS Spreadsheet provides excellent compatibility with Excel VBA macros and slicers, allowing you to run your Auto_Open scripts seamlessly and manage complex data filtering with ease.
- 1. Open the file in WPS Spreadsheet: Launch WPS Office and open your .xlsm workbook.
- 2. Enable Macros: If prompted by a security warning at the top of the sheet, click 'Enable Macros' to allow the Auto_Open script to run.
- 3. Access Developer Tools: Navigate to the Developer tab to view, edit, or manage your VBA code and macros natively.

Frequently Asked Questions
Why doesn't Excel save the slicer multi-select state by default?
Excel's native architecture resets the multi-select toggle button on slicers upon reopening a file. The application is designed to save the actual applied data filters, but not the UI state of the slicer button itself.
Can I apply this macro to multiple slicers at once?
Yes. You can expand the VBA code to select multiple slicer shapes sequentially and send the "%s" keystroke for each one, or write a loop to iterate through all slicer objects on the active worksheet.
What does the SendKeys "%s" command do in the macro?
The SendKeys "%s" command simulates pressing the Alt + S shortcut on your keyboard. This is the default hotkey in Excel for toggling the multi-select option on or off when a slicer is actively selected.




