Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Unanswered: "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!

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I am by no means an Excel aficionado, but does this work?
    Code:
    wsMonth.Cells(2, 12).Value = "some text"
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    Thanks for the suggestion.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •