Re: Use the same click event to populate multiple comboboxes
Quote from pike;770822
Thanks Pike. Your solution is simple and it worked great for my needs.
Re: Use the same click event to populate multiple comboboxes
Quote from pike;770822
Thanks Pike. Your solution is simple and it worked great for my needs.
Re: Use the same click event to populate multiple comboboxes
Quote from pike;770815Hello,
can the same item be picked in each combobox? Yes
Or once an item is picked its not available in the other comboboxes?
What I am trying to do is load the same pick list in all comboboxes so when a user enters the combobox the pick list will already be populated.
I would like to avoid coding for each comboboxes "the drop down list". My project calls for 25 comboboxes using the same drop down list.
Re: Use the same click event to populate multiple comboboxes
Hi.
I am attaching a workbook with code, forms, modules outlined in my original post.
Thanks again for your help.
Dave
Re: Use the same click event to populate multiple comboboxes
Hi Pike. Thanks for the quick reply.
After making the adjustments you suggested the event still does not fire. After reading your first comment I changed the event trigger to "Click" but still the same results. The code for the "enter" event is little beyond my experiences and too much. Do you have any other solutions.
Thanks, Dave
I have a userform(GLSplit) that has 25 combo boxes names ComboBox1.. ComboBox2 etc. inserted on the user form at design and sitting on a Frame.
Problem: I want to use the the same click or enter event to populate these controls when the control gets focus. I used the suggested code found at
http://www.ozgrid.com/forum/showthread.php?t=172689&highlight=event+multiple+comboboxes
but the event will not fire.
Code in class module named:GLSplitCB set to Private
Option Explicit
Public WithEvents myCBox As MSForms.ComboBox
Private Sub myCBox_Enter()
MsgBox "Fired"
BuildGLPickList 'Public Procedure to build list of items for dropdown in combobox (called from main module)
End Sub
Code inserted into Userform module
Dim myCommonComboBoxes As New Collection 'Inserted at top of module
Private Sub UserForm_Initialize()[INDENT]Dim oneBox As GLSplitCB
'.... my code
For item = 1 To 25 'Set all comboboxes to use same click event
Set oneBox = New GLSplitCB
Set oneBox.myCBox = Me.Controls("ComboBox" & Format(item)) 'I changed "cbo" to "ComboBox" Tired both ways. Neither works.
myCommonComboBoxes.Add item:=oneBox
Next item
Set oneBox = Nothing
'.... my code
end sub
Display More