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).
- As I said, you could have a lot of applications running which makes the system run of the memory. You can close all those applications that are unnecessary.
- You have a lot of lengthy codes in the same module. You can try to use different modules for all those codes.
- The Windows run out of virtual memory.
Below I have shared a few links that can help you to deal with this error.
More on VBA Errors
Subscript Out of Range (Error 9) | Type Mismatch (Error 13) | Runtime (Error 1004) | Object Required (Error 424) | Object Doesn’t Support this Property or Method (Error 438) | Invalid Procedure Call Or Argument (Error 5) | Overflow (Error 6) | Automation error (Error 440) | VBA Error 400