> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Why Do I Need to Set Objects to Nothing in VBA?
- URL: https://nolongerset.com/setting-objects-to-nothing/
- Published: 2023-03-20T22:57:48.000Z
- Updated: 2026-05-08T12:50:58.000Z
- Description: Everyone knows you need to set object variables to nothing in VBA, right? ... Right?
- Author: Mike Wolfe
- Tags: VBA, COM, #Import 2026-05-20 02:59

I received a version of the following question from a reader the other day:

> Why do I need to set objects to Nothing? Something about releasing resources. Doesn't seem to affect performance.

Here's a modified version of **my response**, with links to some useful articles on the topic:

> Generally speaking, [you don't usually need to explicitly set object variables to Nothing in VBA](https://nolongerset.com/memory-management-in-vba/) as the language cleans them up automatically when the procedure exits.   
>  
> Technically speaking, VBA takes care of incrementing the [COM reference count](https://nolongerset.com/managing-memory-in-com/) when an object is created and decrementing the reference count when the object variable [goes out of scope](https://nolongerset.com/scope-vs-extent-in-vba/). One thing you do need to be careful to avoid is creating [circular references](https://nolongerset.com/circular-references/), though that's mostly an issue if you have pairs of classes that refer to each other via something like a `.Parent` and `.Child` class property.

---

### Referenced articles

[Memory Management in VBA: 3 Keys to Avoiding Memory LeaksManaging memory in VBA is a piece of cake, especially if you follow three simple guidelines.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/03/dementia-3051832_1920.jpg)](https://nolongerset.com/memory-management-in-vba/)

[Managing Memory in COMWe continue on with our restaurant analogy to explain the concept of reference counting and COM object cleanup.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/03/drinks-2578446_1920.jpg)](https://nolongerset.com/managing-memory-in-com/)

[Scope vs. Extent in VBAMaster the extent and scope of your VBA variables for code that’s efficient, effective, and easy to maintain.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2023/01/Scope-vs.-Extent-in-VBA.jpeg)](https://nolongerset.com/scope-vs-extent-in-vba/)

[Reference Counting’s Fatal Flaw: Circular ReferencesWe look at several types of circular references along with a handy tool that you can use to help identify circular references in your own code.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/04/team-4200837_1920.jpg)](https://nolongerset.com/circular-references/)

*Cover image created with [Microsoft Designer](https://designer.microsoft.com/)*