+ Reply to Thread
Results 1 to 13 of 13

application or object defined error

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    74

    application or object defined error

    hi excelforum,
    i am constantly facing the error 1004 (Application or object defined error).... I am not being able to solve it.. Please help..

    Please Login or Register  to view this content.
    the error is shown on the line below:
    ****If Worksheets(2).Cells(5, 2) = Worksheets(1).Cells(7, a) Then****
    the 5th line of the code..
    Last edited by prajesh; 12-22-2011 at 04:18 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    should work try adding
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    11-15-2011
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: application or object defined error

    hi pike,
    that doesnt work either..........same error!

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    Check that you have "Sheet1" and "Sheet2"

  5. #5
    Registered User
    Join Date
    11-15-2011
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: application or object defined error

    yes, i do have them....
    1st sheet is "Tool Sheet" while 2nd sheet is "Data sheet"

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    Hmmm. Try adding "option explicit" and run the debug
    it will force you to delcare all variables and helps find errors
    also at .value
    Please Login or Register  to view this content.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    only other thing is if it loops and the a value exceeds the columns avaliable?
    use
    Please Login or Register  to view this content.
    this will print all the a values to the immediate window for checking

  8. #8
    Registered User
    Join Date
    11-15-2011
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: application or object defined error

    pike,
    dim filepath as ...............???

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    Hi prajesh

    as string

  10. #10
    Registered User
    Join Date
    11-15-2011
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: application or object defined error

    pike,
    you are my saviour, mate...
    thank u so much.......
    and regarding yesterday's conversation about gilly, do u think ricky had anything to do with gilly's retirement?

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    No, he is a smart man and knew that it was time to go and play 20/20 in India where the big bicks are while he still could.

  12. #12
    Registered User
    Join Date
    11-15-2011
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: application or object defined error

    hmmm..
    and pike, what difference does defining variables make?
    and why is it that the code works without dim statements in some case and doesnt work in rest?

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: application or object defined error

    You can use the VBA help to find an explination on option explict its a very good reference
    why because not declaring dimentions causes an error to occur at compile time.
    a=5 " error

    Dim a as long
    a=5 'no error

+ 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