VBA Out of Memory Error (Error 7)

puneet-gogia-excel-champs

- Written by Puneet

VBA’s Error 7 (Out of Memory) occurs when your system runs out of resources to back up Excel to execute the macro. When you open an application in your system that takes a part of the resource and when you have to try to execute a macro and the resource that you have is not sufficient, you get the error 7.

Apart from that, there are a few points that you need to check when facing this error (Out of Memory).

  1. As I said, you could have a lot of applications running which makes the system run on the memory. You can close all those applications that are unnecessary to check if that works for you.
  2. You have a lot of lengthy codes in the same module. You can try to use different modules for all those codes. (If you have 10 different codes try to split them in 3-4 modules).
  3. Windows run out of virtual memory. This is something which can’t be corrected untill you expand virtual memory.

Below I have shared a few links that can help you to deal with this error.

Last Updated: October 25, 2023