Run-Time error '9': Subscript out of range

Robert_Conklin

Board Regular
Joined
Jun 19, 2017
Messages
173
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I transferred my user-forms and modules to an updated workbook that I was working on and now I get the following error message when I click on my command buttons:

Run-time error '9': Subscript out of range

When I debug it points to the module for the corresponding command button.

One of my user-forms is called "AddNewProject" My module to open the user-form is as follows:

Code:
Public Sub OpenAddNewProject()    AddNewProject.Show
End Sub

The only difference between the workbook that I was working on and the workbook I moved everything to is the name of the file, and there are a few extra tabs that have nothing to do with the code that I am writing.

Any insight would be great!!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Have a look in the Userform Initialise event, do you refer to the workbook name?
 
Upvote 0
No it did not refer to the workbook name, but it did refer to another tab that I had hidden and forgot to move over. That resolved the issue with one of the command buttons, but the other four still receive the same error message.

Thanks
 
Last edited:
Upvote 0
If I remember rightly, go into the VBE select tools > Options > General > select Break in Class Module > OK.
That should then show where the error is occurring.
 
Upvote 0
PERFECT! It was referencing a table that I set up on the old workbook. Once I set up the same table on the new workbook, ALL of the command buttons now open their respective user-forms.

That little change is going help in the future! I had Break on Unhandled errors checked, and that did not give any information!

Thanks again Fluff!
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top