Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Object-defined error???
Hello Everyone,
I ran into a strange problem. I developed a routine that checks dates and entries associated to those dates and puts them into an array. Then according to the dates, it writes to a "startup" page the entries that are not logged in yet. It is notifying me to check a webpage for automatic debits that should be posted. The program works great, BUT... I wrote it separately to get all the bugs worked out, now that they are worked out, I loaded it into my main program and now it doesn't work right. I keep getting an "Application-defined or Object-defined Error" when it hits this line: 'Sheets("Startup").Range("C9:G22").Select 'clear old entries Sheets("Startup").Range("C9:G22").Select Selection.ClearContents Sheets("Startup").Range("E27").Select Now, if I put a ' in front of those 3 lines of code above, then the program works ok. Why will it not clear the contents of the Range C9:G22??? I don't understand??? Beats my two pair?? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Object-defined error???
You can only select a range on the active worksheet.
So: Sheets("startup").select Sheets("Startup").Range("C9:G22").Select Selection.ClearContents Sheets("Startup").Range("E27").Select or even just: Sheets("Startup").Range("C9:G22").ClearContents if you really don't need to select E27. Michael Vaughan wrote: Hello Everyone, I ran into a strange problem. I developed a routine that checks dates and entries associated to those dates and puts them into an array. Then according to the dates, it writes to a "startup" page the entries that are not logged in yet. It is notifying me to check a webpage for automatic debits that should be posted. The program works great, BUT... I wrote it separately to get all the bugs worked out, now that they are worked out, I loaded it into my main program and now it doesn't work right. I keep getting an "Application-defined or Object-defined Error" when it hits this line: 'Sheets("Startup").Range("C9:G22").Select 'clear old entries Sheets("Startup").Range("C9:G22").Select Selection.ClearContents Sheets("Startup").Range("E27").Select Now, if I put a ' in front of those 3 lines of code above, then the program works ok. Why will it not clear the contents of the Range C9:G22??? I don't understand??? Beats my two pair?? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro error : Application-defined or object-defined error | Excel Discussion (Misc queries) | |||
Error 1004 Application Defined or Object Defined Error | Excel Programming | |||
Macro Run-time Error 1004 Application Defined or Object Defined Error | Excel Programming | |||
Runtime Error 1004 -- Application Defined or Object Defined Error | Excel Programming |