问个题,大家把解决方案都贴一下,多谢哈 :)

问个弱弱的问题,大家把解决方案都贴一下,谢谢哈 :)
昨晚睡床上,突然想到的这个问题
问题:
说是有这么个数组被定义成如下形式
dim arrData(32767,4) as string
此数组中的数据一直在发生着变化,我举个简单的例子:
假充我们在加载form时,自己先定义好部份数据
arrdata(0,0)="aaa"
arrdata(0,1)="ccc"
arrdata(1,0)="ddd"
arrdata(1,1)="eee"
问题是如何最快速度的打印出数组中的数据?
最笨的办法是:
dim i,j as intger
for i =0 to 32767
  if trim(arrdata(i,0))<> "" then
  for j=0 to 4
  if arrdata(i,j)<> "" then
  debug.print arrdata(i,j)
  end if 
  next j
  end if 
next i

上面是最笨的办法可以说没有任何效率可言,现在的问题就是如何最快速的知道在第一维中
存在的实际数据长度是多少?
大家多多想想办法,谢谢哈:)

------解决方案--------------------
为了让你明白我说的算法,我可以给你举个例子:

假如你有某个数组,它可能存在于x行y列。x的可能值从0-32757;y的可能值从0-3。而实际你的有效数据只有20个,那么怎么存储它呢?

1、建立一个tpData类型。

Type tpData
x as integer
y as byte
d as string
End Type

Dim arrDatas() as tpData

2、建立一个缓冲数组。
Dim BufferBytes(32767,3) as Byte

3、把数据注册到缓冲数组。
i是arrDatas()的索引。
BufferBytes(arrDatas(i).x,arrDatas(i).y)=i

假如要查第x,y号数据:
d=arrDatas(BufferBytes(x,y)).d

假如要列举出所有有效数据:
打印arrDatas(0-n).d。n是有效数据的数量,在此例子里是19(20个数据)。