0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Excel VBAで静的2次元配列を使用してみる

Posted at

1. はじめに

  • Excel VBAで2次元配列の使い方を知りたい

2. 開発環境

  • VBA
  • Excel 2021

3. サンプルコード

  • Integer型の静的2次元配列(1, 2)を宣言する
  • 各要素数には0を含む
Sample1()
Public Sub Sample1()

    ' 静的2次元配列の宣言
    Dim iArray(1, 2) As Integer
    
    iArray(0, 0) = 0
    iArray(0, 1) = 1
    iArray(0, 2) = 2
    iArray(1, 0) = 10
    iArray(1, 1) = 11
    iArray(1, 2) = 12
    
    For x = 0 To 1
        For y = 0 To 2
            Debug.Print iArray(x, y)
        Next y
    Next x

End Sub
実行結果
 0 
 1 
 2 
 10 
 11 
 12 

4. 参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?