How to clear the entire array?

前端 未结 8 871
不思量自难忘°
不思量自难忘° 2021-02-02 05:06

I have an array like this:

Dim aFirstArray() As Variant

How do I clear the entire array? What about a collection?

相关标签:
8条回答
  • 2021-02-02 05:59

    For deleting a dynamic array in VBA use the instruction Erase.

    Example:

    Dim ArrayDin() As Integer    
    ReDim ArrayDin(10)    'Dynamic allocation 
    Erase ArrayDin        'Erasing the Array   
    

    Hope this help!

    0 讨论(0)
  • 2021-02-02 06:00
    ReDim aFirstArray(0)
    

    This will resize the array to zero and erase all data.

    0 讨论(0)
提交回复
热议问题