View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default subscript out of range

You will also get this error if you try to fill the 11th item of a 10 item
array. The array may be initalized but if it is too small then you are
hooped. Unlike C which will allow you to write outside the boundaries of the
array which is a horror I am glad to be done with.
--
HTH...

Jim Thomlinson


"Leith Ross" wrote:


Hello lvcha.gouqizi,

When using dynamic arrays, arrays with empty (), you must use the ReDim
statement to set the element size of the array. If you have not set the
size of the array, the system will give you subscript out of range.

Your UDT (User Defined Type) contains 2 dynamic arrays which must be
set to some size before you try to store a value to them. ReDim allows
you to change the number of elements as needed, but you must change the
array size before trying to store or retrieve a value to avoid the
subscript out of range error.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=480258