+ Reply to Thread
Results 1 to 8 of 8

Macro error - Run time error 1004 (App defined/Object Defined error)

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    84

    Macro error - Run time error 1004 (App defined/Object Defined error)

    There is something in my code which is causing a run time error when used. I have this same basic line of code in several other macros to simply copy the formula down to the last row of data. For whatever reason, it doesn't work in this macro. The only thing I can think of is that the data that is being manipulated is in the last column with data. Could that be the culprit? Here is the piece of code that is problematic...

    Note: the bolded line is where it takes me when I try to debug.


    Please Login or Register  to view this content.

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

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    Maybe ...

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    hi jlax34, have you checked the LastRow variable? I suppose it's equal to zero or even negative. Add the following line after:

    Please Login or Register  to view this content.
    If it's not post a workbook where this error can be reproduced with your code.

  4. #4
    Registered User
    Join Date
    05-29-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    Shg,

    Popped that in and while I didn't get an error, it also didn't copy the formula down to the last row.

    waterserv,

    Last Row does = 0

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

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    The code enters the formula through the last used cell in col F, unless col F is empty.

  6. #6
    Forum Guru
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    zero value causes error when using Resize method, it should be Long type and more than zero

  7. #7
    Registered User
    Join Date
    05-29-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    Ahh gotcha! F is a blank column in this spreadsheet, but it hasn't been in any of the other spreadsheets I've used this in. I thought it may be referencing a blank column, but the novice I am was looking on the wrong row for the reference. That fixed the problem. Thank you both for your time!

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

    Re: Macro error - Run time error 1004 (App defined/Object Defined error)

    If it should be through the last used cell in col O,

    Please Login or Register  to view this content.

+ 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