Hi All,
I am a newbie in VBA and was trying to create a userform that will allow me to track what my people are doing. it compose of parts where data should be inputed.
One part is choosing between options in combobox.
The chosen option in combobox1 will dictate the list of items available in combobox2.
I have made it work in the first userform.
What I did, and this is where the problem starts, is to export that userform so I can recreate it and import in the same workbook. The reason behind this is because I have 4 options (using command buttons) and each options will load userforms. the userforms will have the same inputs but will vary in the validations of the comboboxes.
So i have imported the exported userform and named it userform2. i have defined the parameters of the combobox1 in this userform that will dictate the list available in its combobox2. this is where I am getting the error below:
it is in the below code where I am getting the error:
Below is the code I used, which is copied from google too. This is the same code loaded in the original userform that i exported
Please note that I did not change anything in the codes. i did however change the RowSource to the appropriate one.
Also, the list for validations are all in the same tab but on different rows.
Hope someone can help as I don't know what to do anymore.
Thanks,
John Mend
I am a newbie in VBA and was trying to create a userform that will allow me to track what my people are doing. it compose of parts where data should be inputed.
One part is choosing between options in combobox.
The chosen option in combobox1 will dictate the list of items available in combobox2.
I have made it work in the first userform.
What I did, and this is where the problem starts, is to export that userform so I can recreate it and import in the same workbook. The reason behind this is because I have 4 options (using command buttons) and each options will load userforms. the userforms will have the same inputs but will vary in the validations of the comboboxes.
So i have imported the exported userform and named it userform2. i have defined the parameters of the combobox1 in this userform that will dictate the list available in its combobox2. this is where I am getting the error below:
Runtime Error 380: Could Not Set the RowSource Property. Invalid Property Value
it is in the below code where I am getting the error:
Code:
.RowSource = strRange
Below is the code I used, which is copied from google too. This is the same code loaded in the original userform that i exported
Code:
Private Sub ComboBox1_Change()
Dim strRange As String
If ComboBox1.ListIndex > -1 Then
strRange = ComboBox1
Label2.Caption = strRange
strRange = Replace(strRange, " ", "_")
With ComboBox2
.RowSource = vbNullString
.RowSource = strRange
.ListIndex = 0
End With
Else
Label2.Caption = "New Business"
End If
End Sub
Also, the list for validations are all in the same tab but on different rows.
Hope someone can help as I don't know what to do anymore.
Thanks,
John Mend
Last edited: