There are a couple of tutorials in the Tutor's Corner about debugging programs and error handling, you might want to check them out.
Before you add any error handling code, the first thing to do is to try to prevent an error. If you declare an integer rather than a string and get an error, it makes no sence to add error code; just change dimention.
The most basic of all error handling code is the On Error statement. Generally, you'll put it at the beginning of the sub or function.