If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > "Application-defined or object-defined error" in Excel 2003

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-09, 15:42
rzt5 rzt5 is offline
Registered User
 
Join Date: Mar 2009
Posts: 2
"Application-defined or object-defined error" in Excel 2003

Hello all.

I am programming Excel 2003 and I am getting the error "Application-defined or object-defined error" (#1004) on the following line:

wsMonth.Cells(2, 12) = "some text"

I have the following prior to it:

Dim wsMonth As Worksheet
Set wsMonth = ActiveWorkbook.Sheets("Month")

The worksheet is properly defined because I can issue the following in the Immediate window without error, and I get the correct data in that cell:

? wsMonth.Cells(2, 12)

There is no Range set so this refers to cell L2 in the worksheet. The cell is formatted as "General".

In fact, I am able to reference most any cell in the worksheet and get its value but when I try to assign to it, I get the error.

I have tried all variations of referencing the cell (workbook(2).worlsheet("Month").Cells(), etc.) and always get the same error. I have also tried unprotecting the worksheet.

I have read at least 50 other Google links about this error and most seem to be related to invalid cell addresses. This is NOT the case here. I can use the exact same cell reference to get the current value in the cell. This thing is really pissing me off. I'd like to get the developers of Excel in a room for a few minutes (not to talk).

Any help is appreciated.

Thanks!
Reply With Quote
  #2 (permalink)  
Old 03-05-09, 03:50
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I am by no means an Excel aficionado, but does this work?
Code:
wsMonth.Cells(2, 12).Value = "some text"
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 03-05-09, 11:56
rzt5 rzt5 is offline
Registered User
 
Join Date: Mar 2009
Posts: 2
Thanks for the suggestion.

Yes, I tried that but still got the same error.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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