Solved

Erase array content with VBA

Posted on 2015-02-03
3
122 Views
Last Modified: 2015-02-03
I have defined a 2D array

Dim myArray (1 To 20, 1 To 3)

erase myArray

It seems that the content of the array can't be erased. I need to clear its content when the invoice number is changed. Any idea ?

Tks
0
Comment
Question by:AXISHK
3 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 250 total points
ID: 40587835
ReDim will erase it if you don't use a Preserve.
https://msdn.microsoft.com/en-us/library/w8k3cys2.aspx
0
 
LVL 81

Assisted Solution

by:zorvek (Kevin Jones)
zorvek (Kevin Jones) earned 250 total points
ID: 40587850
Why do you believe that Erase does not do what you desire?

Erase clears all elements of the array and sets them to Empty.

Kevin
0
 

Author Closing Comment

by:AXISHK
ID: 40587861
Tks. There is a logical bug in my program and I haven't erase it when the program is rerun again, Tks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 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

15 Experts available now in Live!

Get 1:1 Help Now