Link to home
Start Free TrialLog in
Avatar of Massimo Scola
Massimo ScolaFlag for Switzerland

asked on

Excel Multicolumn Listboxes. How to manually add additional data before data is inserted

I populate a multicolumn listbox with data from an array.
However, I would like to add one or two additional values manually before the array is populated that will appear at the top.

This is how I populate the listbox

With Me.lstContracts
.ColumnCount = 4
.ColumnWidths = "40,150;100,100"

    If arrContracts(x, colRecyclingContractCustomerID) = CustomerID Then
            .AddItem
            .List(.ListCount - 1, 0) = arrContracts(x, 1)
            .List(.ListCount - 1, 1) = arrContracts(x, colRecyclingContractSubscriptionName)
            .List(.ListCount - 1, 2) = arrContracts(x, colRecyclingContractFirstPickup)
            .List(.ListCount - 1, 3) = arrContracts(x, colRecyclingContractLastPickup)
    
    End If

End With
Next x

Open in new window


I understand that .addItem has an optional parameter that would allow me to specify the index but it looks like this only works in single column listboxes - not in multi like mine.
I would like to add a value 0 and/or 1

Any ideas how to solve this?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Massimo Scola

ASKER

Oh that's great - I can even add two values to it before I add data from an array to the listbox. Thanks for your help!