=0 th" />
将一个包含有20个字数据的数组ARRAY分为两个数组?
sub test()
dim arr,m(),n(),x&,i&,j&
arr=range("A1:A400")
for x=1 to ubound(arr)
if arr(x,1)>=0 then
i=i+1
redim preserve m(1 to i)'正数
m(i)=arr(x,1)
elxe
j=j+1
redim preserve n(1 to j)'负数
n(j)=arr(x,1)
end if
next x
range("B1").resize(ubound(m))=application.transpose(m)
range("C1").resize(ubound(n))=application.transpose(n)
end sub
此代码把A列的数据按正负分别写入B和C列,0算入正数