Appendix C: VBA Error Codes
This appendix contains a complete listing of the error codes for all trappable errors in Visual Basic for Applications (VBA). This information is useful for error trapping. For complete details, consult Excel's Help system.
|
Error Code |
Message |
|
3 |
Return without GoSub. |
|
5 |
Invalid procedure call or argument. |
|
6 |
Overflow (for example, value too large for an integer). |
|
7 |
Out of memory. This error rarely refers to the amount of physical memory installed on your system. Rather, it usually refers to a fixed-size area of memory used by Excel or Windows (for example, the area used for graphics or custom formats). |
|
9 |
Subscript out of range. You will also get this error message if a named item is not found in a collection of objects. For example, if your code refers to Sheets(“Sheet2”), and Sheet2 does not exist. |
|
10 |
This array is fixed or temporarily locked. |
|
11 |
Division by zero. |
|
13 |
Type mismatch. |
|
14 |
Out of string space. |
|
16 |
Expression too complex. |
|
17 |
Can't perform requested operation. |
|
18 |
User interrupt occurred. This error occurs if the user interrupts a macro by pressing the Cancel key. |
|
20 |
Resume without error. This error probably indicates that you forgot the Exit Sub statement before your error handler code. |
|
28 |
Out of stack space. |
|
35 |
Sub or Function not defined. |
|
47 |
Too many Dynamic Link Library (DLL) application clients. |
|
48 |
Error in loading DLL. |
|
49 |