VBA如何添加數(shù)組元素?
使用集合collection的key唯一性除去重復(fù)的值
suba()
dima(1to100)
dimbasnewcollection
dimiasinteger
a(1)=1
a(2)=3
a(3)=5
a(4)=7
a(5)=3
a(6)=5
a(7)=2
onerrorresumenext
fori=1to100
b.adda(i),str(a(i))
nexti
fori=1tob.count
a(i)=b(i)
nexti
endsub
VBA如何添加數(shù)組元素?
使用集合collection的key唯一性除去重復(fù)的值
suba()
dima(1to100)
dimbasnewcollection
dimiasinteger
a(1)=1
a(2)=3
a(3)=5
a(4)=7
a(5)=3
a(6)=5
a(7)=2
onerrorresumenext
fori=1to100
b.adda(i),str(a(i))
nexti
fori=1tob.count
a(i)=b(i)
nexti
endsub