Too many local, nonstatic variables
Local, nonstatic variables are variables that are defined within a procedure and reinitialized each time the procedure is called. This error has the following cause and solution:
- The sum of the memory requirements for this procedure's local, nonstatic variables and compiler-generated temporary variables exceeds 32K. Declare some of your variables with the Static statement where appropriate. Static variables retain their value between procedure invocations because they are allocated from different memory resources than nonstatic variables.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.