View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.scripting.vbscript
Steve Fulton Steve Fulton is offline
external usenet poster
 
Posts: 1
Default Enumerating a multi-dimensional array

Robert Stober wrote:
I've built a multi-dimensional array from a table and would like to
enumerate the whole thing, but I'm confused. Can anyone help me out?


For Each elm In ary
WScript.echo elm
Next

Apparently, VBScript stores arrays in column-major order, so this will
produce:

ary(0, 0, 0, ...)
ary(1, 0, 0, ...)
ary(2, 0, 0, ...)
...
ary(n, 1, 0, ...)
ary(n, 2, 0, ...)
...
etc.

But it's the simplest, most general way.

--
Steve

The believer is happy; the doubter is wise. -Hungarian proverb