Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Control Userform Multicolumn excel

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Just an observation, unless i missed something obvious

I have a form with the following controls

txt_status
cbo_clientref
cbo_dyear
cbo_dday
cbo_dmonth
txt_contractno
txt_shareholder
txt_fundname
txt_amountreceived
txt_salescharge
txt_amountinvested
txt_price
txt_sharesissued
txt_total
cbo_type

and a listbox called lst_contracts

If i try to update the listbox like this

Code:
Dim int_lcount As Integer ' for finding out list value
int_lcount = lst_contracts.ListCount


With lst_contracts
    .AddItem
   .Column(1, int_lcount) = txt_status
   .Column(2, int_lcount) = cbo_clientref
    .Column(3, int_lcount) = cbo_clientref.Column(1, cbo_clientref.ListIndex)
    .Column(4, int_lcount) = cbo_dday
    .Column(5, int_lcount) = cbo_dmonth
    .Column(6, int_lcount) = cbo_dyear
   .Column(7, int_lcount) = txt_contractno
   .Column(8, int_lcount) = txt_shareholder
    .Column(9, int_lcount) = txt_fundname
    .Column(10, int_lcount) = txt_amountreceived
    .Column(11, int_lcount) = txt_salescharge
    .Column(12, int_lcount) = txt_amountinvested
    .Column(13, int_lcount) = txt_price
    .Column(14, int_lcount) = txt_sharesissued
    .Column(15, int_lcount) = txt_total
End With

I get an error always at .column(10 even though the listbox has enough columns.

Setting the columncount in code makes no difference
using .list instead of column seems to make no difference

In the end i have split the listbox into two.

Im using Excel 2003



Chance,

F, G + HH
 
From VBA Help topic for the ColumnCount property:

For an unbound data source, there is a 10-column limit (0 to 9).

Ed Metcalfe.

Please do not feed the trolls.....
 
[kicks himself in the foot]
dope, missed that!
[/kicks himself in the foot]



Chance,

F, G + HH
 
AS a better workaroudn im now using a hidden sheet

Chance,

F, G + HH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top