Posts by Dave McDonald

    Re: Use the same click event to populate multiple comboboxes


    Quote from pike;770822

    Oh in that case all you need is

    Code
    Private Sub UserForm_Initialize()
        Dim lngCount As Long
        For lngCount = 1 To 25 
            Me.Controls("ComboBox" & lngCount).List = Application.Transpose(Range("A1:A10"))
        Next lngCount
    End Sub


    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;770815

    Hello,
    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 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


    Code
    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