How to Rename an Excel Slicer for VBA and Cube Formulas
Question details
Users need to rename a recreated slicer to match its original name so that dependent VBA macros and cube formulas continue to function properly.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Replacing or recreating slicers in a workbook where existing macros or cube formulas explicitly reference the old slicer's internal name.
- Observed behavior
- VBA code and cube formulas fail to execute or return errors because they are attempting to reference a slicer name that no longer exists after the replacement.
Before modifying slicer names, review your VBA code or cube formulas to identify the exact slicer name they are expecting, as the new name must be an identical match.
Update the Slicer Name via Slicer Settings
The most direct way to rename a slicer for formulas and macros is to modify its internal name property through the Slicer Settings menu.
Every slicer has a visual 'Caption' that users see, and an internal 'Name' used by the system for formulas and VBA. Updating the internal name resolves reference errors caused by replacing slicers.
Click on the recreated slicer in your worksheet to make it active.
Navigate to the 'Slicer' tab on the top ribbon and click on 'Slicer Settings'.
Locate the 'Name to use in formulas' text box. Clear the default name and type in the exact name expected by your VBA code or cube formula.
Click 'OK' to save the new slicer name and test your macros.

Rename the Slicer Reference Using the Name Manager
If the slicer is exposed as a defined name in your workbook, you can update its reference globally using the Excel Name Manager.
Manage Slicers and Macros Seamlessly with WPS Spreadsheet
WPS Spreadsheet provides comprehensive support for pivot tables, slicers, and advanced VBA macros. Easily control your data dashboard settings and defined names in a lightweight, highly compatible environment.
- 1. Open your workbook: Launch WPS Spreadsheet and open your existing file containing the slicers and macros.
- 2. Access Slicer Settings: Click on any slicer to reveal the contextual Slicer tab, allowing you to instantly rename it for formulas.
- 3. Manage defined names: Go to the Formulas tab and open the Name Manager to verify or edit your slicer references globally.
- 4. Run macros securely: Use the integrated macro tools to test your VBA code and ensure the updated slicer names resolve properly.

Frequently Asked Questions
Why does my VBA code fail after deleting and recreating a slicer?
When you recreate a slicer, the software automatically assigns it a new default internal name (e.g., Slicer_Category1). Because your existing VBA code is programmed to look for the old slicer's specific name, it cannot find it, resulting in a runtime error. You must rename the new slicer to match the old one or update the VBA script.
What is the difference between a slicer's Caption and its Name?
The Caption is the visual title displayed at the top of the slicer interface for users to read. The Name (specifically 'Name to use in formulas') is the hidden internal identifier that Excel, VBA, and cube functions use to reference the slicer programmatically.
Can I use spaces in a slicer name?
No, slicer names used in formulas and VBA cannot contain spaces. They must begin with a letter or an underscore, and can only contain alphanumeric characters and underscores. If you need a space for readability, use an underscore instead (e.g., Region_Slicer).




