vba courses london - setting all variables zero

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Setting all variables to zero

vba courses london - Setting all variables to zero

resolvedResolved · Low Priority · Version Standard

Peter has attended:
Excel VBA Intro Intermediate course

Setting all variables to zero

We were shown how to set individual variables to zero (or empty them in the case of string varibles), but is there any one line piece of code to set all variables to zero or remove all variables in memory.

Thanks

RE: setting all variables to zero

Hi Peter

If you mean you want to initialise all variables to zero when you create them, you can create one main variable and set it to zero, then for all the other variables you create you can reference the original variable, thus they will be initialised to the value held within the original variable.

In regards to removing all variables in memory you want to use a process called garbage collection. I am not familiar with the code for this in VBA, but in asp.net the command is GC.Cellect(). I will look into this in greater depth and get back to you.

Hope this helps

David

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

VBA tip:

Use GoTo to Select A Cell With VBA

To select a certain cell on a Worksheet you can use:

Application.Goto Reference:=Range("V300")

or more simply

Range("V300").Select

If, on the other hand, you want the selected cell to be the top/left cell on the screen you use:

Application.Goto Reference:=Range("V300"), Scroll=True

View all VBA hints and tips


Server loaded in 0.05 secs.