logo
search
VBA & Macro Problems

Fix RefEdit Control Error this.setActiveSheet is not a function in Excel

Emma BrownEmma Brown Oct 14, 2026 870 views

Question details

The user encounters a functional error when using the RefEdit control to select a data range in a spreadsheet.

Fix RefEdit Control Error this.setActiveSheet is not a function
Product
Excel
Device & OS
not provided
Scenario
Using the RefEdit control within a custom dialog or macro environment to select a range of cells.
Observed behavior
The system displays an error stating 'Unable to get data range. this.setActiveSheet is not a function.'
Before you start

Ensure you have saved a backup copy of your macro-enabled workbook before modifying the VBA code or running an Office repair.

Solution 1Recommended

Update and Repair Microsoft Office

Since this error often stems from an internal glitch or corrupted library handling the RefEdit control, repairing the Office installation and applying the latest updates can resolve the issue.

The RefEdit control relies on specific Office libraries. If these become corrupted or outdated, standard functions may fail to execute properly, triggering JavaScript or VBA-related object errors.

1
Close Applications

Save your work and close all open Microsoft Office applications, including Excel.

2
Open Programs and Features

Open the Windows Control Panel, select 'Programs', and then click on 'Programs and Features'.

3
Initiate Repair

Locate your Microsoft Office installation in the list, right-click it, and select 'Change'. Choose 'Online Repair' and follow the on-screen instructions.

4
Update Office

Once the repair is complete, open Excel, navigate to 'File' > 'Account', click on 'Update Options', and select 'Update Now' to ensure you are on the latest build.

Update and Repair Microsoft Office
Free Microsoft Office alternative

Try WPS Office for a Smoother Spreadsheet Experience

If you are experiencing persistent VBA or macro errors in Microsoft Excel, consider switching to WPS Office. It is a free, lightweight, and highly compatible alternative that supports advanced spreadsheet functions and macros without the heavy resource load.

  1. 1. Download WPS Office: Visit the official WPS website to download the free installer.
  2. 2. Install and Launch: Run the installer and open WPS Spreadsheets.
  3. 3. Open Your Workbook: Open your existing Excel files directly in WPS Office with full format compatibility.
Free to use with a fast, lightweight installation processHighly compatible with Microsoft Excel formats including .xlsx, .xls, and .xlsmFamiliar user interface for seamless migration without a learning curveBuilt-in support for advanced formulas and macro scripting capabilities
microsoft office alternative - wps office

Frequently Asked Questions

What is the RefEdit control in Excel VBA?

The RefEdit control is a dialog box element used in Excel user forms. It allows users to collapse the dialog box and manually select a range of cells directly from the worksheet using their mouse.

Why am I getting a 'this.setActiveSheet is not a function' error?

This error generally points to a corrupted library reference, an add-in conflict, or a bug within the Office environment. It indicates that the script execution failed because the object reference does not support the 'setActiveSheet' method in the current context.

Can a corrupted Office add-in cause RefEdit errors?

Yes, third-party add-ins or outdated COM add-ins can sometimes conflict with Excel's native dialog controls like RefEdit. Disabling unnecessary add-ins from 'File' > 'Options' > 'Add-ins' can help isolate and resolve the issue.