Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
On my userform I have two combo boxes and one read-only textbox. In the first text box the user selects a machine production line. Based on the machine production line selected, the second combo box will populate with the products that are ran on that line which is located on a spreadsheet named for that line. The problem that throws a "Run-time error '9': Subscript out of range" is when the user exits the first combobox and makes a selection from the second combobox and then decides to go back to the first combo box. The code that is highlighted when I select the Debug option is shown below.
By the way, the names associated with above boxes are:
First combobox Name=cmbSDPFLine
Second combobox Name=cmbPrdCde
Read Only Textbox Name=txtbxPrdctNm
Thank You.
NOTE: As long as the user continues through the form as normal and doesn't return back to the combo boxes, no error is thrown.
By the way, the names associated with above boxes are:
First combobox Name=cmbSDPFLine
Second combobox Name=cmbPrdCde
Read Only Textbox Name=txtbxPrdctNm
Code:
Private Sub cmbPrdCde_Change()
Me.txtbxPrdctNm.Value = Replace(Split(Me.cmbPrdCde.Value, "(")(1), ")", vbNullString)
End Sub
NOTE: As long as the user continues through the form as normal and doesn't return back to the combo boxes, no error is thrown.
Last edited: