Issue with comboboxes

newbie_12

New Member
Joined
Nov 12, 2013
Messages
11
Hi!

I have added this same bit of code in a few userform but it works as intended (ie. show all 3 columns of the combobox) only in the first userform created. In the subsequent userforms it only shows the first column. I can't seem to figure out why? Any of you have an idea?? Private Sub UserForm_Initialize()
Dim cell_Participant As Range
Dim ws1 As Worksheet
Set ws1 = Worksheets("Participant Lookup List")

For Each cell_Participant In ws1.Range("StudentID")
With Me.Comboparticipant
.AddItem cell_Participant.Value
.List(.ListCount - 1, 1) = cell_Participant.Offset(0, 1).Value
.List(.ListCount - 1, 2) = cell_Participant.Offset(0, 2).Value
End With
Next cell_Participant
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Did you name all subsequent combo boxes Comboparticipant?
 
Upvote 0
Also, make sure ColumnCount field is set to 3. If you add the line Me.Comboparticipant.ColumnCount = 3 before your loop, that should do the trick, in theory.
 
Upvote 0
Did you name all subsequent combo boxes Comboparticipant?


No I did not. I named the consequent ones Comboparticipant1 and Comboparticipant2.


for userform2
rivate Sub UserForm_Initialize()
Dim cell_Participant As Range
Dim cell_status As Range
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Participant Lookup List")
Set ws2 = Worksheets("Lookup List - Other")
For Each cell_status In ws2.Range("Enrolment_Status")
With Me.Combostatus
.AddItem cell_status.Value
End With
Next cell_status

For Each cell_Participant In ws1.Range("StudentID")
With Me.Comboparticipant2
.AddItem cell_Participant.Value
.List(.ListCount - 1, 1) = cell_Participant.Offset(0, 1).Value
.List(.ListCount - 1, 2) = cell_Participant.Offset(0, 2).Value
End With
Next cell_Participant
End Sub


And userform3
Private Sub UserForm_Initialize()
Dim cell_Participant As Range
Dim cell_covisor As Range
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Participant Lookup List")
Set ws2 = Worksheets("Lookup List - Other")
For Each cell_covisor In ws2.Range("Facilitators")
With Me.Combocovisor
.AddItem cell_covisor.Value
End With
Next cell_covisor

For Each cell_Participant In ws1.Range("StudentID")
With Me.Comboparticipant1
.AddItem cell_Participant.Value
.List(.ListCount - 1, 1) = cell_Participant.Offset(0, 1).Value
.List(.ListCount - 1, 2) = cell_Participant.Offset(0, 2).Value
End With
Next cell_Participant
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,108
Messages
6,170,142
Members
452,304
Latest member
Thelingly95

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