Is it possible to set all variables to zero at once?

raeannb

Board Regular
Joined
Jun 21, 2011
Messages
86
Hi! I thought for sure someone would have asked about this already, but I didn't have any luck searching the message board. I'd like to know if it's possible to simultaneously set all of my variables (or at least, my integer variables) to zero with a single line of code.

Right now I'm counting a number of things (each described by an integer variable) with a loop that exists within a bigger loop (bigger loop cycles through different worksheets). The little loop counts get reported to the active worksheet. I'd like all of my variables to re-set to zero before starting my little loop again on the next worksheet. The variables are named after what they describe, so their names are unique. I'd like to keep it this way, though I know if I just turned them into an array I could easily clear the values. Right now I have a looooong list of variables getting set to zero (var1=0, var2=0...var3847583=0...YUCK).

Is there a way to do what I'd like here? Thank you!!
 
Depends on the exact setup, it may be simpler to extract the data from various sources into one table first and then create the pivot table. Of course the PT has to be created only once, next time you just refresh it against the new data.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top