「Excel VBA」配列の要素の値を変更するサンプル

2021年2月9日

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Sub testFunc()
Dim cft As Variant
cft = Array("A001", "B002", "C003", "D004")
cft(2) = "test002"
Debug.Print cft(0)
Debug.Print cft(1)
Debug.Print cft(2)
End Sub
Sub testFunc() Dim cft As Variant cft = Array("A001", "B002", "C003", "D004") cft(2) = "test002" Debug.Print cft(0) Debug.Print cft(1) Debug.Print cft(2) End Sub
Sub testFunc()
    
    Dim cft As Variant
    cft = Array("A001", "B002", "C003", "D004")
    
    cft(2) = "test002"

    Debug.Print cft(0) 
    Debug.Print cft(1) 
    Debug.Print cft(2)

End Sub

 

Excel VBA

Posted by arkgame