Combobox with multi columns - 2 different issues

Meat4grinder

Board Regular
Joined
May 20, 2012
Messages
66
Trying to populated 2 combo box with multi columns the first one i am trying to just populated the combobox with client/company names. The second one i want to go thru doors and any that dont have a linked id (DoorInfoWS.Range("B" & a).Value = "") for that row to populated the combo box.

Also this there a code i can use in the first combobox (CBox_Client) that when i start typing a name or company it would bring up most likely match/ or sort for that letter combination?

Code:
Set DoorInfoWS = Sheets("Door info")Dim FinalRow As Integer


FinalRow = CompInfoWS.Cells(CompInfoWS.Rows.Count, "A").End(xlUp).Row
    For i = 3 To FinalRow
        With Me.CBox_Client
            .AddItem i
            .Column(0) = i                                      'Row location
            .Column(1) = CompInfoWS.Range("A" & i).Value        'Company ID
            .Column(2) = CompInfoWS.Range("B" & i).Value        'Company Name
            .Column(3) = CompInfoWS.Range("C" & i).Value        'Contact or client name
            .Column(4) = CompInfoWS.Range("D" & i).Value        'Address
        End With
    Next i
    
FinalRow = DoorInfoWS.Cells(DoorInfoWS.Rows.Count, "A").End(xlUp).Row
    For a = 3 To FinalRow
        If DoorInfoWS.Range("B" & a).Value = "" Then
            With Me.Cbox_Door
                .AddItem a
                .Column(0) = a                                      'Row location
                .Column(1) = DoorInfoWS.Range("A" & i).Value        'Door ID
                .Column(2) = DoorInfoWS.Range("C" & i).Value        'Address of door
                .Column(3) = DoorInfoWS.Range("D" & i).Value        'location at address
                .Column(4) = DoorInfoWS.Range("E" & i).Value & " x " & DoorInfoWS.Range("F" & i).Value         'Size of door
            End With
        End If
    Next a


End Sub

Error - "Run-time error '381': Could not set the column property. Invalid property array index."
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
SOLVED

Code:
Private Sub UserForm_Initialize()Set CompInfoWS = Sheets("Company info")
Set DoorInfoWS = Sheets("Door info")
Dim FinalRow As Integer
Dim Addrow As Integer


Addrow = -1
FinalRow = CompInfoWS.Cells(CompInfoWS.Rows.Count, "A").End(xlUp).Row
    For i = 4 To FinalRow
        Addrow = Addrow + 1
        With Me.CB_Client
            .BoundColumn = 0
            .ColumnCount = 5
            .ColumnWidths = "20;20;80;80;100"
            .AddItem
            .Column(0, Addrow) = i                                      'Row location
            .Column(1, Addrow) = CompInfoWS.Range("A" & i).Value        'Company ID
            .Column(2, Addrow) = CompInfoWS.Range("B" & i).Value        'Company Name
            .Column(3, Addrow) = CompInfoWS.Range("C" & i).Value        'Contact or client name
            .Column(4, Addrow) = CompInfoWS.Range("D" & i).Value        'Address
        End With
    Next i


Addrow = -1
FinalRow = DoorInfoWS.Cells(DoorInfoWS.Rows.Count, "A").End(xlUp).Row
    For i = 3 To FinalRow
        If DoorInfoWS.Range("B" & i).Value = "" Then
        Addrow = Addrow + 1
            With Me.CB_Door
                .BoundColumn = 0
                .ColumnCount = 5
                .ColumnWidths = "20;20;80;100;40"
                .AddItem
                .Column(0, Addrow) = i                                      'Row location
                .Column(1, Addrow) = DoorInfoWS.Range("A" & i).Value        'Door ID
                .Column(2, Addrow) = DoorInfoWS.Range("C" & i).Value        'Address of door
                .Column(3, Addrow) = DoorInfoWS.Range("D" & i).Value        'location at address
                .Column(4, Addrow) = DoorInfoWS.Range("E" & i).Value & " x " & DoorInfoWS.Range("F" & i).Value         'Size of door
            End With
        End If
    Next i




End Sub
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

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