no error no list items in multiple comboboxes on userform

Mussa

Active Member
Joined
Jul 12, 2021
Messages
251
Office Version
  1. 2019
  2. 2010
Hi
exprets
I use this code for multiple comboboxes doesn't show any thing despite of the seems to show in empty four items as in sheet and there is no error .
I have userform contains four comboboxes for each row on userform start combobox 49 .
when slelect the item in combobox49 should populate item in combobox 50,51,52 and so on for the others
but doesn't show any thing in combobox49 when run the userform .

can any body explain me what happens?
VBA Code:
Private Sub UserForm_Initialize()
With Sheets("BRANDS")
    With .Range("B2", .Cells(.Rows.Count, "B").End(xlUp))
        For i = 49 To 52
            Me.Controls("ComboBox" & i).List = .Offset(, i - 1).Value
            Me.Controls("ComboBox" & i + 4).List = .Offset(, i - 1).Value
            Me.Controls("ComboBox" & i + 8).List = .Offset(, i - 1).Value
        Next
    End With
End With

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
This code only runs when the form first pops up (UserForm_Initialize). If you want it to run when you change the combo boxes, put this code (with a new Sub name) in a Module and have the all the combo box Change events (e.g. ComboBox49.Change) call that sub.
VBA Code:
Private Sub ComboBox49_Change()
Call UpdateMe
End Sub

I'm not sure what you're trying to do with your .Offsets. Your range is potentially a lot of rows in the B column. What row are you offsetting from? Are you trying to put multiple rows into the comboboxes, or just one?
Also, I don't think you're using .List correctly.
"Use .List to copy an entire two-dimensional array of values to a control. Use .AddItem to load a one-dimensional array or to load an individual element."
 
Upvote 0
This code only runs when the form first pops up (UserForm_Initialize)
yes this is what I'm talking about it.
the problem doesn't show anything and there is no error from normally when run the userform should populates items in multiple comboboxes.
Are you trying to put multiple rows into the comboboxes
yes
I no know what's my mistake?
 
Upvote 0
I'm still not sure I understand what you want.
Does ComboBox49-51 always get their lists from the same columns. If so, which column for which combobox?
Or do the other ComboBoxes depend on what is selected in ComboBox49? If so, where does 49 get it's list from and how does that offset from the selection in 49?

The Offset in your first row shows offsetting 48 columns over on the same row from something (I think you mean column B). is that correct?
 
Upvote 0
Does ComboBox49-51 always get their lists from the same columns. If so, which column for which combobox?
you mean 49-52 , then yes . the same thing the others (53-56) , (57-60) ... and so on
they're linked with columns B,C,D,E for each four comboboxes.
and when select the first combobox 49 or 53 or 57 .... will fill the others comboboxes . for instance when select combobox49 will fill combobox50,51,52 and the same things the others comboboxes are selected will fill them .
(I think you mean column B). is that correct?
yes
and this is what happens when select combobox49
VBA Code:
Private Sub ComboBox49_Change()
Dim c As Range
With Sheets("BRANDS")
  
    Set c = .Range("B:B").Find(What:=ComboBox49.Value, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
    If Not c Is Nothing Then
        ComboBox50.Value = c.Offset(, 1).Value
        ComboBox51.Value = c.Offset(, 2).Value
        ComboBox52.Value = c.Offset(, 3).Value
        TextBox23.Value = c.Offset(, 4).Value
       
    End If
End With
End Sub
also the same thing for combobox53 with change combobox number combobox in the code
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
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