1
I have a UserForm with three OptionButton and three ListBox.
When opening the UserForm all three ListBox are loaded with different texts, because each one relates to a type of data as is explicit in each OptionButton.
Us ListBox it is allowed to select more than one option.
The ListBox are disabled at the opening of the UserForm.
By clicking on the first OptionButton, the code to which it refers removes the selections (if any) from the others ListBox, and disable them, the same will happen if you click on one of the others OptionButton.
By clicking the UPDATE button, the code of the same checks which OptionButton is active, and runs through the ListBox corresponding by filling a dynamic array (array) with the name of the selected texts.
The code works perfectly, already well tested. My question: clicking on any of the OptionButton, the array has to be emptied and no size to be filled again from scratch, so I can use ReDim(0) or Erase Array.
Which one should I wear?
According to Internet searches, I believe it’s Erase, because the information is that wipes the memory to use the array again.







Erase is usually used before Redim, since the latter resizes the array by holding the values.
– Paulo Vieira
OK. Grateful for the answer. But I want to not only erase the data from the array, but also resize it to zero.
– Paulo Semblano
Only the Erase is sufficient.
– Paulo Vieira