I am trying to create a data entry form in Excel and having intermittent issues with a run time 9 error subscript out of range. I have commented out the code and commented in the code several times getting it to work. My form is using combo boxes based on tables + text boxes. The tables are kept in 1 sheet and the target worksheet is titled WAV_Activity_Recap. I have not yet set a control button to display the user form.
Your UserForm Initialize Event code assumes that all your tables are on the activesheet which is not the case so if you try to open the UserForm when the Tables Sheet is not the active sheet, the code is unable to find those tables on the activesheet. To handle that issue, replace the UserForm_Initialize Event code with the following one...
I just tried the suggestion and still getting the run time 9 error....
Subodh Tiwari (Neeraj)
When do you get that error? Can you let me know the action you perform which leads to that error?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Robert Casaletta
ASKER
Okay, I added Worksheets("Tables").Activate after Set wsTables = Worksheets("Tables") and it seems to have worked. I will do some-more testing and keep you posted. If I may, when I select an item from the combo box, it does not appear but it does add to the targeted worksheet...any clues?
Subodh Tiwari (Neeraj)
No, that is really not required i.e. you don't need to activate the Tables sheet if you correctly qualified the tables with the parent sheet. See the attached with a button on Switchboard Sheet, click that button and the UserForm will be popped up without any error.
I didn't quite get your question, which ComboBox you are talking about? What do you mean by "it does not appear"?
Unlimited question asking, solutions, articles and more.
Subodh Tiwari (Neeraj)
Yes, the consultant and the activity comboboxes had the same issue. I deleted both the comboboxes and inserted the new comboboxes with the default properties and they both work ok now.
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
To handle that issue, replace the UserForm_Initialize Event code with the following one...
Open in new window