+ Reply to Thread
Results 1 to 5 of 5

Application-Defined or Object-Defined Error

  1. #1
    Registered User
    Join Date
    03-26-2013
    Location
    Virginia US
    MS-Off Ver
    Excel 2010
    Posts
    7

    Application-Defined or Object-Defined Error

    Evening ladies & gents,

    I got this piece of code used to run fine but I started getting the above message.

    Please Login or Register  to view this content.
    The colored rows are the ones that have the issue.
    Im guessing it has something to do with the Cells reference.
    Any assistance would be much appreciated.

    Cheers

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Application-Defined or Object-Defined Error

    Why bother with the
    Please Login or Register  to view this content.
    I don't really understand that line of code. Couldn't it just be
    Please Login or Register  to view this content.
    At any rate, the following didn't give me any errors:
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Application-Defined or Object-Defined Error

    Hi Chinpunk

    I tested your code and found out that the problem occurs when MyLastRow variable = 1, because then MyVar tries to refer to row No.... 0, which obviously doesn't exist.
    I think this can be fixed using this:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-26-2013
    Location
    Virginia US
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Application-Defined or Object-Defined Error

    Yes, Mordred indeed that line of code does not make sense.
    I copied pasted from the above line thinking that its one cell down in the same column.
    I ran the script again seems to be working.

    Thank you for your time.

  5. #5
    Registered User
    Join Date
    03-26-2013
    Location
    Virginia US
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Application-Defined or Object-Defined Error

    Hey Sbarro,

    Thanks for your reply.
    When i was hovering my mouse over the MyLastRow I saw the =1 value.
    I will give your code a try in case that error shows up again.
    By the way im using excel 2010 version.

    Thank you for you time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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