Excel VBA Basic Training

Excel VBA Basic Training

Debugging

Debugging Macros

When a macro errors out it will popup a window with the error type and debug option.  You want to click Debug and it will highlight which line is causing the error in yellow.  In the example below VBA is trying to select a worksheet called “shee” which does not exist so it throws the error Subscript out of range.  Which basically means the referenced object cannot be found.  The best course of action when this happens is to google search the error message, ie.  google search:  VBA Subscript out of range Sheets(“Shee”).select.  Then read what solutions the community has posted related to that error.  Majority of the time you will be able to find the solution to the debug by searching google.

List of error codes can be found here.

how to debug a macro
how to debug a macro

[efb_likebox fanpage_url="https://www.facebook.com/vbamarket/" box_width="840" box_height=340"" responsive="1" show_faces="1" show_stream="1" hide_cover="1" small_header="0" hide_cta="0" locale="en_US"]

Add comment