VBA & Macro Problems

How to Rename an Excel Slicer for VBA and Cube Formulas

Algirdas JasaitisAlgirdas Jasaitis Nov 2, 2026 870 views

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.

How to Rename an Excel Slicer for VBA and Cube Formulas
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 you start

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.

Solution 1Recommended

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.

1
Select the slicer

Click on the recreated slicer in your worksheet to make it active.

2
Open Slicer Settings

Navigate to the 'Slicer' tab on the top ribbon and click on 'Slicer Settings'.

3
Edit the formula name

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.

4
Apply changes

Click 'OK' to save the new slicer name and test your macros.

Update the Slicer Name via Slicer Settings
Naming Rule: Ensure the 'Name to use in formulas' contains no spaces and matches the VBA reference exactly, including underscores.
Advanced Spreadsheet Tool

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. 1. Open your workbook: Launch WPS Spreadsheet and open your existing file containing the slicers and macros.
  2. 2. Access Slicer Settings: Click on any slicer to reveal the contextual Slicer tab, allowing you to instantly rename it for formulas.
  3. 3. Manage defined names: Go to the Formulas tab and open the Name Manager to verify or edit your slicer references globally.
  4. 4. Run macros securely: Use the integrated macro tools to test your VBA code and ensure the updated slicer names resolve properly.
Fully compatible with Microsoft Excel formats (.xlsx, .xlsm, .xlsb)Intuitive Slicer Settings for rapid dashboard managementBuilt-in Name Manager for precise and reliable formula controlRobust Macro environment for running and editing VBA code
microsoft office alternative - wps office

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).