+ Reply to Thread
Results 1 to 11 of 11

Debugging : Application defined or object defined error

  1. #1
    Registered User
    Join Date
    07-04-2015
    Location
    USA
    MS-Off Ver
    MS Excel 2007
    Posts
    5

    Debugging : Application defined or object defined error

    Hi my code groups areas with same value i.e. it reads a cell that is not yet assigned to a area and find all cells which are connected to it ( similar to tracing the tree from its root to its leaves except that the root is the first cell that has not been assigned to any area previously) have the same value as it has to form an area.

    This is the code which I have written to for the above task:

    When I run the code I get the following error:

    "Application defined or object defined error"

    Please Login or Register  to view this content.
    I hope someone could help me in debugging this error as excel debug is not very helpful.

    Thanks in advance
    Last edited by |)iGiTaL; 07-04-2015 at 01:52 PM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Debugging : Application defined or object defined error

    When I run the code I get the following error:

    "Application defined or object defined error"
    Although it's helpful to describe the error, it even more helpful to also state at which line you are getting the error.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Debugging : Application defined or object defined error

    This line at the start of FindTrustZone will error if row is = 1
    Please Login or Register  to view this content.
    A fix would be
    Please Login or Register  to view this content.
    In the failing code (when row=1) the line tries to evaluate whether Cells(0, col) = x (trying to look at row 0 is the error)

    In the second code, if row = 1, it doesn't try to evaluate Cells(row -1, col)
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    07-04-2015
    Location
    USA
    MS-Off Ver
    MS Excel 2007
    Posts
    5

    Re: Debugging : Application defined or object defined error

    @skywriter

    The error occurs in every executable line in function FindTrustZones.

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Debugging : Application defined or object defined error

    I don't know about using a keyword like row as a variable. Every executable line?
    How do you get it to go to the other lines after it stops on the first executable row, which it should do if it causes an error?
    Last edited by skywriter; 07-05-2015 at 12:03 PM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Debugging : Application defined or object defined error

    I think you have a few logic errors.

    This ...

    Please Login or Register  to view this content.
    ... turns this

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    1
    1
    1
    2
    2
    3
    4
    6
    7
    7
    2
    1
    3
    3
    3
    4
    6
    7
    7
    2
    4
    3
    1
    2
    2
    3
    3
    3
    3
    3
    5
    5
    4
    1
    3
    5
    6
    6
    1
    1
    3
    4
    5
    5
    1
    1
    3
    4
    5
    6
    6
    1
    1
    2
    6
    1
    2
    4
    4
    6
    6
    7
    7
    1
    1
    7
    1
    2
    2
    3
    3
    5
    6
    1
    2
    3
    8
    1
    2
    4
    4
    6
    6
    1
    3
    3
    5
    9
    1
    1
    3
    4
    5
    6
    7
    7
    2
    3
    10
    1
    2
    3
    5
    6
    1
    1
    2
    2
    4
    11
    1
    3
    3
    3
    5
    5
    5
    5
    6
    7
    12
    1
    2
    3
    4
    5
    7
    2
    2
    3
    5
    13
    1
    3
    3
    4
    5
    5
    6
    7
    2
    4
    14
    1
    2
    2
    3
    4
    5
    5
    5
    5
    7
    15
    1
    1
    3
    4
    4
    5
    6
    7
    7
    2
    16
    1
    3
    3
    4
    4
    5
    6
    6
    6
    1


    ... into this:

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    TZ-1 TZ-1 TZ-1 TZ-2 TZ-2 TZ-3 TZ-4 TZ-5 TZ-6 TZ-6
    2
    TZ-1 TZ-7 TZ-7 TZ-7 TZ-8 TZ-9 TZ-10 TZ-10 TZ-11 TZ-12
    3
    TZ-1 TZ-13 TZ-13 TZ-7 TZ-7 TZ-7 TZ-7 TZ-7 TZ-14 TZ-14
    4
    TZ-1 TZ-15 TZ-16 TZ-17 TZ-17 TZ-18 TZ-18 TZ-7 TZ-19 TZ-14
    5
    TZ-1 TZ-1 TZ-20 TZ-21 TZ-22 TZ-23 TZ-23 TZ-24 TZ-24 TZ-25
    6
    TZ-1 TZ-26 TZ-21 TZ-21 TZ-23 TZ-23 TZ-27 TZ-27 TZ-24 TZ-24
    7
    TZ-1 TZ-26 TZ-26 TZ-28 TZ-28 TZ-29 TZ-30 TZ-31 TZ-32 TZ-33
    8
    TZ-1 TZ-26 TZ-34 TZ-34 TZ-35 TZ-35 TZ-36 TZ-37 TZ-37 TZ-38
    9
    TZ-1 TZ-1 TZ-39 TZ-34 TZ-40 TZ-35 TZ-41 TZ-41 TZ-42 TZ-43
    10
    TZ-1 TZ-44 TZ-39 TZ-45 TZ-46 TZ-47 TZ-47 TZ-42 TZ-42 TZ-48
    11
    TZ-1 TZ-39 TZ-39 TZ-39 TZ-49 TZ-49 TZ-49 TZ-49 TZ-50 TZ-51
    12
    TZ-1 TZ-52 TZ-39 TZ-53 TZ-49 TZ-54 TZ-55 TZ-55 TZ-56 TZ-57
    13
    TZ-1 TZ-39 TZ-39 TZ-53 TZ-49 TZ-49 TZ-58 TZ-59 TZ-60 TZ-61
    14
    TZ-1 TZ-62 TZ-62 TZ-63 TZ-64 TZ-49 TZ-49 TZ-49 TZ-49 TZ-65
    15
    TZ-1 TZ-1 TZ-66 TZ-64 TZ-64 TZ-49 TZ-67 TZ-68 TZ-68 TZ-69
    16
    TZ-1 TZ-66 TZ-66 TZ-64 TZ-64 TZ-49 TZ-67 TZ-67 TZ-67 TZ-70
    Last edited by shg; 07-05-2015 at 12:57 PM.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    07-04-2015
    Location
    USA
    MS-Off Ver
    MS Excel 2007
    Posts
    5

    Re: Debugging : Application defined or object defined error

    @skywriter: I was able to debug the error. Thanx for your help

    @shg: No I dont have logic error. My logic is correct. That I have checked.

    @mikerickson : Thanx for helping me debug the error.

    This is the first time I am coding in VBA, so might ask really silly doubts too pls bear with me.

    After correcting code as mentioned by mikerickson, I encountered a new error "Run time error 28 out of stack space". Any help on that ??

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Debugging : Application defined or object defined error

    Quote Originally Posted by |)iGiTaL View Post
    @shg: No I dont have logic error. My logic is correct. That I have checked.
    This moves right (which I would call East), not left, and you should be checking that you're not in the rightmost column:

    Please Login or Register  to view this content.
    Last edited by shg; 07-05-2015 at 01:02 PM.

  9. #9
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Debugging : Application defined or object defined error

    After correcting code as mentioned by mikerickson, I encountered a new error "Run time error 28 out of stack space". Any help on that ??
    Recursive calls?
    Out of Stack Space.

  10. #10
    Registered User
    Join Date
    07-04-2015
    Location
    USA
    MS-Off Ver
    MS Excel 2007
    Posts
    5

    Re: Debugging : Application defined or object defined error

    oh ok i get it.

  11. #11
    Registered User
    Join Date
    07-04-2015
    Location
    USA
    MS-Off Ver
    MS Excel 2007
    Posts
    5

    Re: Debugging : Application defined or object defined error

    @skywriter: yes Im calling the function recursively.
    I cant get ride of the recursive calls as I need it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 05-08-2014, 04:57 AM
  2. [SOLVED] application-defined/object-defined error 1004 when trying to read from or write to cells
    By florin_excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2012, 08:38 AM
  3. Replies: 2
    Last Post: 09-12-2012, 01:01 PM
  4. Application Defined or Object Defined Error, Command Button and Vlookup Function
    By stevedomer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-14-2011, 11:20 PM
  5. Replies: 3
    Last Post: 07-24-2006, 08:20 PM

Tags for this Thread

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