Vba error codes in Excel

As seen from the previous chapter, there are two types of errors in VBA and within each type, there are a number of subsets.

For example, the compile time error may be due to wrong syntax, unassigned variable,undeclared variable or wrong placement of the keywords and so on.

Similarly, there are a number of reasons for runtime error too.

But, all the errors, irrespective of the type, has some number (code) associated with it.

These codes help identify the errors easily, since each code corresponds to a particular error only and always.

For example, error code 6 always implies an overflow.

There are a number of error codes in VBA, some of which are as follows:

51 : Internal error.

52 : Bad Filename or number.

53 : File not found.

54 : Bad File mode.

55 : File already open.

57 : Device lnput/Output (l/O) error.

58 : File already exists.

59 : Bad record length.

61 : Disk full.

62 : Input past and of ?le.

63 : Bad record number.

67 : Too many files.

68 : Device unavailable.

70 : Permission denied.

71 : Disk not ready.

74 : Can't rename with different drive.

75 : Path/File access error.

76 : Path not found.

321 : Invalid file format.

322 : Can�t create necessary temporary file.

325 : Invalid format in resource file.

380 : Invalid property value.

381 : Invalid property array index.

382 : Set not supported at runtime.


You can find similar Excel Questions and Answer hereunder

1) What is the design mode in the developer Tab in Excel

2) Vba clear the contents of an entire sheet in Excel

3) I have a cell with nested formulas that returns an error. In Excel, how can I step through the formulas to help with debugging?

4) How to handle errors in VBA with the handling error methods

5) Is there a way I can average a range of numbers even if there is an error value in range?

6) How to copy files in Excel VBA is explained here

7) Find and count instances of a character in a string in Excel

8) What are the different type of errors in Excel VBA, subscript out of range, compile error, time out, run time overflow

9) The scenario manager in Excel VBA allows to explore various scenarios in a very easy way

10) How do you know which column was used last, Here the explanation to find it with VBA


Here the previous and next chapter