vba courses london - setting all variables zero
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

replyReply Fri 12 Jan 2007, 16:13Delegate Peter said...

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

For upcoming training course dates see: Pricing & availability

replyReply Mon 15 Jan 2007, 12:58Trainer David said...

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

 

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


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard