Types of Errors

Design Time Errors

These are also often referred to as Syntax Errors.
These are not common as they only occur when the syntax is broken, i.e. incorrectly spelt keywords, mismatched parentheses.
These can be eliminated altogether by using the automatic syntax checker. (Tools > Options) (Editor tab, Auto Syntax Check switched on).

Compile Time Errors

Before your Visual Basic project can be executed it must first be compiled.
You can manually request a project to be compiled by selecting (Debug > Compile Project).
These can occur when the code is compiled, these are most common when trying to assign or retrieve the incorrect property or method.
A message will be displayed when there is a compile time error.
VBA code can still run even though it doesn't compile when (Tools > Options)("Compile on demand") is ticked.

microsoft excel docs

Run Time Errors

These occur when a program is running generated by a statement trying to perform an operation that cannot be carried out (i.e. division by zero).
A message will be displayed when there is a runtime error.

Logical Errors

These occur when the code appears to perform correctly but doesn't actually produce the correct results.
These types of errors are the most dangerous as everything looks and works correctly.
These may or may not cause run time errors.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext