Array() = range().value

后端 未结 3 906
旧时难觅i
旧时难觅i 2021-01-20 15:27

I saw array() = range().value in an example and I\'m trying to understand how it works.

Sub test()
Dim arr() As Variant

arr() = Range(\"E5:E7\         


        
3条回答
  •  时光说笑
    2021-01-20 16:06

    It's basically loading the cell values of E5 - E7 into an array. But it is going to be two dimensional. So you will need Debug.Print arr(i, 1)

    Sub test()
    Dim arr() As Variant
    
    arr() = Range("E5:E7").Value
    For i = 1 To UBound(arr)
        Debug.Print arr(i, 1)
    Next i
    
    End Sub
    

提交回复
热议问题