erase data inside an array

Posted on 2006-05-18
Last Modified: 2010-04-07

Please assist how can we erase the data and elements inside an array?

Question by:RyanBank
    LVL 23

    Accepted Solution

    Use this command (where arr is the name of your array):

    Erase arr
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    the ERASE completely removes the array.

    if you use the following, you empty all the array values:
    REDIM yourarray(<size>) as <data type>

    LVL 23

    Expert Comment

    Here's website that talks about the Erase command:

    By the way, if you totally want to kill the array you can use this command:

    arr = Nothing

    LVL 23

    Expert Comment

    Well, to clarify Angel's comment

    Erase only completely removes dynamic arrays.  In the case of static arrays it empties all of the data values (sets them to default for that data type).
    Also, I do believe you can only use redim on a dynamic array.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now