Erase vs ReDim In Arrays
<p><strong>Background:</strong></p>

<p>I just came across <a href="https://stackoverflow.com/questions/38127809/excel-vba-variant-array-reusable-must-be-erased">this question</a> and made me learn about <a href="https://msdn.microsoft.com/en-us/library/83zyeke9.aspx" rel="nofollow noreferrer">erase</a> statment in arrays.</p>

<p>I have always used the following to reset them:</p>

<pre><code>Sub TestWithRedimOnly()
Dim ExampleArray() As String
    ReDim Preserve ExampleArray(1)
    ExampleArray(1) = "yo"
    MsgBox ExampleArray(1)
    ReDim ExampleArray(0) As String
    MsgBox ExampleArray(1) 'this confirms is reset!
End Sub
</code></pre>

<p>If I do it with erase</p>

<pre><code>Sub TestWithEraseAndRedim()
Dim ExampleArray() As String
    ReDim Preserve ExampleArray(1)
    ExampleArray(1) = "yo"
    MsgBox ExampleArray(1)
    Erase ExampleArray
    MsgBox ExampleArray(1) 'this confirms is reset!
    ReDim ExampleArray(0) As String
    MsgBox ExampleArray(1) 'this confirms is reset!
End Sub
</code></pre>

<p>At the end, both reset the variable.</p>

<p><strong>Question:</strong>
Is it really worthy to use erase statement? Does it prevent memory leaking better than just the <code>Redim.. As..</code> Are there any cases that you can recall about not doing it like so? </p>