VBA & Macro Problems

How to Fix VBA UserForm Run-Time Error 9 in Excel

Natalie TaylorNatalie Taylor Nov 10, 2026 869 views

Question details

The user encounters Run-Time Error 9 when attempting to open or call a VBA UserForm.

How to Fix VBA UserForm Run-Time Error 9 When Opening a Form
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Running a VBA macro to open a UserForm.
Observed behavior
The macro execution halts and displays Run-Time Error 9, typically caused by referencing a form or object name that does not match the actual project name.
Before you start

Ensure you have saved a backup of your macro-enabled workbook (.xlsm) before modifying the VBA code to prevent accidental data loss.

Solution 1Recommended

Verify and Update UserForm Name References

Check the VBA Project Explorer to ensure the exact UserForm name is being called in your macro.

Run-time Error 9 often occurs when the VBA procedure references a form name that is misspelled or does not match the actual name defined in the project.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) Editor.

2
Locate the UserForm

Look at the Project Explorer pane on the left side of the screen. Expand the 'Forms' folder to see all UserForms in your project.

3
Note the Exact Name

Check the exact spelling of the UserForm you want to open (e.g., VIEW_WEEKLY_SCHEDULE_FORM). You can also click the form and check the '(Name)' field in the Properties window below.

4
Update the Calling Macro

Open the module or sheet code containing the click event that calls the form. Update the .Show command to match the exact form name (e.g., VIEW_WEEKLY_SCHEDULE_FORM.Show).

Verify and Update UserForm Name References
Name Matching: VBA is strictly case-insensitive but requires exact character matching for object names. Ensuring an exact match resolves most Error 9 issues related to UserForms.
Advanced Macro Support

Use WPS Spreadsheet for Seamless VBA Macro Execution

WPS Office provides robust support for VBA macros, allowing you to create, edit, and run UserForms smoothly. It offers a familiar VBA Editor interface, making it easy to debug errors like Run-Time Error 9.

  1. 1. Open your Macro Workbook: Launch WPS Spreadsheet and open your .xlsm file.
  2. 2. Access the Developer Tools: Go to the 'Developer' tab on the ribbon and click 'VBA Editor'.
  3. 3. Debug the UserForm: Use the Project Explorer to verify your UserForm names and run the debugger to fix Error 9.
Fully compatible with Microsoft Excel macro-enabled formats (.xlsm, .xltm).Built-in VBA Editor for easy debugging and UserForm creation.Lightweight and fast execution of complex macro scripts.Free to download with a highly intuitive user interface.
microsoft office alternative - wps office

Frequently Asked Questions

What does Run-Time Error 9 mean in VBA?

Run-Time Error 9 typically means 'Subscript out of range'. In the context of UserForms, it occurs when the code tries to reference a form, sheet, or array element that does not exist or is misspelled.

How do I find the real name of my UserForm?

Open the VBA Editor (Alt + F11), look at the Project Explorer pane on the left, expand the 'Forms' folder, and check the name listed next to the form icon. You can also select the form and check the '(Name)' property in the Properties window.

Why does my UserForm work on one computer but give Error 9 on another?

This can happen if the macro relies on specific worksheet names, external files, or add-ins that are present on the first computer but missing or named differently on the second computer. Check your initialization code for external references.