+ Reply to Thread
Results 1 to 4 of 4

Method 'Cells' of object '_Application'failed

  1. #1
    Registered User
    Join Date
    08-28-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    1

    Red face Method 'Cells' of object '_Application'failed

    dear user
    i have open exsisting excel in following code and read the first cell in excel.
    Please Login or Register  to view this content.
    but display the following error

    runtime error 1004
    Method 'Cells' of object '_Application'failed

    thanks:
    Last edited by Leith Ross; 08-28-2009 at 02:45 AM. Reason: Added Code Tags

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Method 'Cells' of object '_Application'failed

    I dont get the same error Do you have the code in "This workbook"

    You could try.
    Please Login or Register  to view this content.

    Please when you post on the forum can you wrap you code in code tage, It makes it a lot ease for people to read and copy.
    You can do this by placing [code ] at the start of the code and [/code ] "without the spaces

    Hope this helps

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Method 'Cells' of object '_Application'failed

    The error is because the application object does not have a cells property.
    Worksheets and ranges have a cells property.


    Edit: As lecxe correctly points out Application does have a Cells property. It refers to the activework books activesheet.
    So note to self. Don't test lines of code without first opening a workbook.
    Last edited by Andy Pope; 08-28-2009 at 05:57 AM.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: Method 'Cells' of object '_Application'failed

    Hi excel2010

    Please Login or Register  to view this content.
    The Cells property of the Application object refers to the cells in the active sheet.

    You get an error if the active sheet is not a worksheet.

    I guess that in your case the active sheet when you opened the file was a chart sheet.

    You should change this statement and specify the worksheet, for example like D_Rennie suggested or using a worksheet name.

    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1