ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   multicolumn listbox - 2002 to 97 (https://www.excelbanter.com/excel-programming/337596-multicolumn-listbox-2002-97-a.html)

George J[_3_]

multicolumn listbox - 2002 to 97
 
The code below is part of a macro i am using. In Xl2000 it works fine, but
cannot get it to work in XL97 - need help.


Call UpdateSort
x = Range("I65536").End(xlUp).Row
'creates multicolumn listbox
Dim MyArray()
MyArray = Range("I2:J" & x)
ListBox1.ColumnWidths = "50;200"
Me.ListBox1.List = MyArray


columns i:k are sorted into numerical order by the UpdateSort macro
i then want listbox1 to show the data in I2:Jx with x being a variable range.
I have the listbox set to 2 columns in the properties, but cannot see how to
get this to work in XL97

Any help appreciated.
George

Norman Jones

multicolumn listbox - 2002 to 97
 
Hi George,

To enable xl97 compatabilitty, try changing:

Dim MyArray()


to:

Dim MyArray as Variant


Prior to xl2k, I beleive that an array could only be assigned to a variant,
not to a dynamic variant array.


---
Regards,
Norman



"George J" wrote in message
...
The code below is part of a macro i am using. In Xl2000 it works fine, but
cannot get it to work in XL97 - need help.


Call UpdateSort
x = Range("I65536").End(xlUp).Row
'creates multicolumn listbox
Dim MyArray()
MyArray = Range("I2:J" & x)
ListBox1.ColumnWidths = "50;200"
Me.ListBox1.List = MyArray


columns i:k are sorted into numerical order by the UpdateSort macro
i then want listbox1 to show the data in I2:Jx with x being a variable
range.
I have the listbox set to 2 columns in the properties, but cannot see how
to
get this to work in XL97

Any help appreciated.
George




George J[_3_]

multicolumn listbox - 2002 to 97
 
You genius.
Works perfectly now.

many thanks
George

"Norman Jones" wrote:

Hi George,

To enable xl97 compatabilitty, try changing:

Dim MyArray()


to:

Dim MyArray as Variant


Prior to xl2k, I beleive that an array could only be assigned to a variant,
not to a dynamic variant array.


---
Regards,
Norman



"George J" wrote in message
...
The code below is part of a macro i am using. In Xl2000 it works fine, but
cannot get it to work in XL97 - need help.


Call UpdateSort
x = Range("I65536").End(xlUp).Row
'creates multicolumn listbox
Dim MyArray()
MyArray = Range("I2:J" & x)
ListBox1.ColumnWidths = "50;200"
Me.ListBox1.List = MyArray


columns i:k are sorted into numerical order by the UpdateSort macro
i then want listbox1 to show the data in I2:Jx with x being a variable
range.
I have the listbox set to 2 columns in the properties, but cannot see how
to
get this to work in XL97

Any help appreciated.
George






All times are GMT +1. The time now is 03:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com