PDA

View Full Version : Solved: Clearing Array contents



BexleyManor
07-28-2004, 03:31 AM
mmmm, where to start!!

I have an array that I wish to 'flush out' the values from after a specific action has taken place in order for it to be re-populated with fresh values.

Any suggestions folks?? :dunno

XL-Dennis
07-28-2004, 03:34 AM
Hi and welcome to VBAX :)

As a start check out Erase in the directhelp.

Kind regards,
Dennis

BexleyManor
07-28-2004, 03:41 AM
Sorry, where do I find the directhelp section??

Richie(UK)
07-28-2004, 03:43 AM
Hi BM,

How about using ReDim (without the Preserve option)?

Like this:Sub Test()
Dim lArray() As Long

ReDim lArray(10) As Long
lArray(0) = 123
MsgBox lArray(0)

ReDim lArray(10) As Long
MsgBox lArray(0)

End SubHTH

XL-Dennis
07-28-2004, 03:47 AM
Hi,

Write the word Erase in the VB-editor, highlight it and hit the F1-button.

Kind regards,
Dennis

BexleyManor
07-28-2004, 03:53 AM
Dennis, thanks for that great little tip, I'll be using that again for sure!!

BexleyManor
07-28-2004, 06:13 AM
Thanks for the quick response Richie, I shall follow your advise..

Zack Barresse
07-30-2004, 06:09 PM
Hey there,

Did this information help you solve this one BexleyManor?

BexleyManor
08-02-2004, 12:10 PM
Yes indeed, it was in conjunction with my do Loop question and both were solved to perfection, All hail the VBA Express Gods !!!! :vv