Runtime Error 381 Couldn't set list property, invalid array index

N

Newbillian

I opened a 97 spreadsheet in 2003 and now each time a user form is
initialized a runtime error comes up in the following line in the vba
code:

ComboDeptNum.List = Sheets("Definitions").Range("$J$1:$I$12")

It is the same thing if I specify a named range:
ComboDeptNum.List = Sheets("Definitions").Range("DeptList")


This exact same codes works fine in 97 and the security is set to low
in 2003. The number of columns is set propoerly but the list box just
won't load values. I'm a newbie to Excel vba but have more experience
with Access and never saw this 381 in Access.

Thanx in advance for help on this.
 
D

Dick Kusleika

Newbillian

I wasn't aware of any changes to List from 97 to 2003, but maybe it did
change. Try writing it as

ComboDeptNum.List = Sheets("Definitions").Range("DepList").Value

and see if that gets rid of the error. If not, post the exact text of the
error message and any other details you think may be necessary. I assume
the ColumnCount property is okay since it works in 97. I don't have 2003
handy, but I'll test it out later if the above doesn't work.

Nevermind all that. I just tested it in 2000 without the .Value property
and got error 381. With the .Value property, it worked fine. I don't know
why that changed from 97, but it should work.
 
J

Jamie Collins

...
I just tested it in 2000 without the .Value property
and got error 381. With the .Value property, it worked fine.

The evil of default properties strikes again. Almost as evil as multiposting ...

Jamie.

--
 
Top