VBA - What variable types should be manually unloaded at the end of a macro

dumitrudan608

New Member
Joined
Dec 7, 2010
Messages
19
Hi,

I'm trying to make myself a cleaner coder, and hopefully write code that does not slow down every time I run it.

Can anyone help me with a list of variable types that need to be set to nothing or unloaded from memory manually at the end of a macro?

Thank you,
Daniel
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Anything that is declared as Static or Public, which is no longer needed. Everything else should automatically unload when the procedure ends.
 
Upvote 0
It depends on their scope. If they are local to the procedure they are used in, they will be cleared at the end anyway, so you don't need to do anything. If they are module level or public, and you don't need them stored, then clearing them is advisable.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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