Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Problem solved. Thank you very much.
"Chip Pearson" wrote: By default, error trapping is set at "break unhandled errors". A side effect of this is that any error that occurs in an object module (e.g., a class module or userform) will cause the code to stop and enter debug mode on the line of code that created an instance of an object. In your code, there is really nothing wrong with the code Form_MyForm.Show, and you could spend all day trying to figure out what is wrong. However, this is the code that instantiates the form to an object. Any error in the form will cause a break on this line of code. In VBA, go to the Tools menu, choose Options, then the General tab. There, ensure that "Break In Class Module" is selected. When this option is in effect, the compiler will break on the actual line of code that is causing the problem. You should ALWAYS have Break In Class Module in effect. I can't think of any good reason that you would want it otherwise. An error 9 -- subscript out of range -- typically occurs when you attempt to retrieve an item from a collection and that item doesn't exist. For example, if you have no worksheet named "DoesNotExist", the code Set WS = Worksheets("DoesNotExist") will throw an error 9 because there is no such sheet in the Worksheets collection. Cordially, Chip Pearson Microsoft MVP Excel 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com [email on web site] On Wed, 18 Nov 2009 13:01:01 -0800, Scott wrote: I encountered "Run-time error '9': Subscript out of range" at this line: Form_MyForm.Show The form is sitting there and no spelling error. Anyone can help? Thanks. . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Error handling error # 1004 Run-time error | Excel Programming | |||
Run Time Error 1004: Application or Object Defined Error | Excel Programming | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming |