Runtime Error 380: Could Not Set the RowSource Property. Invalid Property Value

archrael

New Member
Joined
Oct 29, 2015
Messages
6
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:

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
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
 
Last edited:

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
John

Are you trying to populate ComboBox2 using a named range?

If so does that named range exist in the workbook the userform is in?
 
Upvote 0
what is the value of strRange when you try to assign it as row source for combobox2?

I would guess it is some text that Excel cannot understand. strRange must be a range address or name.
 
Upvote 0
HI Norie and Bob,

It seems like the code can't find the name range. thanks for the idea thrown and it helps a lot. i was able to figure out what happened. :):)
 
Upvote 0
Hi John


I hade the same problem. I solved this with this code:
Code:
Private Sub UserForm_Initialize()
    food = Range("list!$C$3:$C$10")
    cmbM1.List = food
    
End Sub
At least it's working on my macOS sierra and excel 2011 for mac

Regards
Peter
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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