Thread: Array Test
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Array Test

What does "proactively test an array for data" mean?

If the array is not dynamic it always exists in the sense that memory
is allocated to it.

If the non-dynamic array is not declared as variant all data elements
are initialized to something (yes, even object or string arrays:
Nothing for the former, zero length string for the latter)

For an array of type variant use IsEmpty(x(i))

For a dynamic array that has not been dimensioned with a redim
statement a error trap is mandatory. Maybe, you can explain why you'd
rather not use one...

Once a dynamic array is dimensioned, the same rules as in para 3 above
apply.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Does anyone know how to proactively test an array for data prior to its use
without using an error event?

If not, what is a good error test?

I have been using 'Err.Number = 9' as a test to call the population routine.

Thanks,
VBA Dabbler