当前位置:首页>维修大全>综合>

vba多维数组实例讲解

vba多维数组实例讲解

更新时间:2023-09-10 11:10:56

vba多维数组实例讲解

VBA数组可以用来表示多维数组,即元素的排列不只是一个维度,而是多个维度。以下是一个具体的实例:

Sub SampleArray()

Dim MyArray(2, 3, 4) As Integer

    MyArray(0, 0, 0) = 1

    MyArray(0, 0, 1) = 2

    MyArray(0, 0, 2) = 3

    MyArray(0, 0, 3) = 4

    MyArray(0, 0, 4) = 5

    MyArray(0, 1, 0) = 6

    MyArray(0, 1, 1) = 7

    MyArray(0, 1, 2) = 8

    MyArray(0, 1, 3) = 9

    MyArray(0, 1, 4) = 10

    MyArray(0, 2, 0) = 11

    MyArray(0, 2, 1) = 12

    MyArray(0, 2, 2) = 13

    MyArray(0, 2, 3) = 14

    MyArray(0, 2, 4) = 15

    MyArray(1, 0, 0) = 16

    MyArray(1, 0, 1) = 17

    MyArray(1, 0, 2) = 18

    MyArray(1, 0, 3) = 19

    MyArray(1, 0, 4) = 20

    MyArray(1, 1, 0) = 21

    MyArray(1, 1, 1) = 22

    MyArray(1, 1, 2) = 23

    MyArray(1, 1, 3) = 24

    MyArray(1, 1, 4) = 25

    MyArray(1, 2, 0) = 26

    MyArray(1, 2, 1) = 27

    MyArray(1, 2, 2) = 28

    MyArray(1, 2, 3) = 29

    MyArray(1,

更多栏目