vb如何給二維數(shù)組賦值 vb二維數(shù)組轉(zhuǎn)化為一維數(shù)組?
vb二維數(shù)組轉(zhuǎn)化為一維數(shù)組?Dim I as integer,j as integer假設(shè)有一個(gè)二維數(shù)組a(2,3)const r as integer=2const C as integer=3Di
vb二維數(shù)組轉(zhuǎn)化為一維數(shù)組?
Dim I as integer,j as integer
假設(shè)有一個(gè)二維數(shù)組a(2,3)
const r as integer=2
const C as integer=3
Dim b((2,1)*(3,1)-1)“定義一個(gè)新的一維數(shù)組
對(duì)于I=0到r
對(duì)于j=0到C
b(I*(3,1)j)=a(I,J) “將二維數(shù)組的所有元素賦給一維數(shù)組
下一個(gè)J
下一個(gè)I
對(duì)于I=0到(b)
打印b(I)”打印一維數(shù)組
下一個(gè)
VBA二維數(shù)組如何轉(zhuǎn)一維數(shù)組?一維如何轉(zhuǎn)二維?
一維到二維。
Msgbox Arr1(2,1)“轉(zhuǎn)換后的數(shù)組是一個(gè)具有一列和多行的二維數(shù)組,end sub 2。二維數(shù)組轉(zhuǎn)換為一維數(shù)組。
arr3=應(yīng)用程序.轉(zhuǎn)置( 應(yīng)用程序索引(arr2,2))“獲取arr2的第二列數(shù)據(jù)并將其轉(zhuǎn)置到一維數(shù)組msgbox arr3(2,)