How to clear the entire array ?

How to clear the entire array ?

Asked on January 7, 2019 in Excel.
Add Comment


  • 3 Answer(s)

    By using the Erase or ReDim method to clear the array:

    Dim threeDimArray(9, 9, 9), twoDimArray(9, 9) As Integer
    Erase threeDimArray, twoDimArray
    ReDim threeDimArray(4, 4, 9)
    

    Refresh, to remove a group, by using the remove method :

    For i = 1 to MyCollection.Count
      MyCollection.Remove 1 ' Remove first item
    Next i
    
    Answered on January 7, 2019.
    Add Comment

    Use the guidance Erase, for deleting a dynamic array in VBA

    Try this example code ;

    Dim ArrayDin() As Integer 
    ReDim ArrayDin(10)     *//Dynamic allocation 
    Erase ArrayDin     *//Erasing the Array
    
    Answered on January 7, 2019.
    Add Comment

    Use this simple solution :

    Erase aFirstArray
    
    
    Answered on January 7, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.