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!