Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro error : Application-defined or object-defined error Joe Excel Discussion (Misc queries) 3 January 27th 06 02:32 PM
Error 1004 Application Defined or Object Defined Error Garry[_6_] Excel Programming 2 October 1st 04 10:33 AM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM
Runtime Error 1004 -- Application Defined or Object Defined Error John[_51_] Excel Programming 3 September 4th 03 04:28 PM


All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"