multicolumn listbox - 2002 to 97

G

Guest

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
 
N

Norman Jones

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top