+ Reply to Thread
Results 1 to 13 of 13

Recorded macro gets formula error

  1. #1
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Recorded macro gets formula error

    I Recorded a Macro and when I test what I Recorded Macro, I get a “run-time error ‘1004’: Application-defined or object-defined error” asking if I want to debug or End, I click debug and it highlights the Active Cell Formula, why

    This is the original Formula that was entered in the Cell.
    =IF(T21="Yes","show",IF(IF(D21*1>=$D$15,IF(D21*1<=$D$16,IF((INDEX(Alignment_Reports,ROW()-20,COLUMN()+$R$10))*1>=$E$16,IF((INDEX(Alignment_Reports,ROW()-20,COLUMN()+$R$10))*1<=$F$16,"show","offset too high"),"offset too low"),"stationing too high"),"stationing too low")="show",IF(S21="Storm","show",IF(S21="Sanitary","Sanitary","not Sewer")),"Don't Show"))

    Please Login or Register  to view this content.
    Last edited by CityMPLSEmpolyee; 02-09-2012 at 09:55 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recored macro gets formula error

    Try this:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recored macro gets formula error

    Thanks JBeaucire
    but I get the same error

  4. #4
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recored macro gets formula error

    I would also like to note that in the recoreding of the macro it deletes part of the formula
    at the end you should see "not Sewer")),"Don't Show"))
    but the recording gets "ewer")),"Don't Show"))

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recorded macro gets formula error

    Time to post a workbook with verbal description of the logic to evaluate in the order of importance. Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

  6. #6
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recorded macro gets formula error

    These are the two functions that are not working for me.
    See attached file.
    Please Login or Register  to view this content.
    I am also work on a macro that will identify if a button has been deleted or not (see if then statement). And the above code will be called into that as will. So note I am still working on other parts of the workbook, but most of it is done.
    See macro named "Make_New_Plan_Sheet_Tab", all this you can find in module "Module04_template"

    Thanks for your help.
    Attached Files Attached Files
    Last edited by CityMPLSEmpolyee; 02-07-2012 at 09:44 AM.

  7. #7
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recorded macro gets formula error

    question, could may formula be to long (is there a limit in macros )?

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recorded macro gets formula error

    Switch from the FormulaR1C1 syntax to just the Formula syntax and enter the formula into the entire range all at once using the formula for R21 as the formula basis:

    Please Login or Register  to view this content.

    Wrapping lines of code is meant for your own sanity, it isn't required.

  9. #9
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recorded macro gets formula error

    Thank you very much,
    That works great.

    Your help and everyone else at this forum are great help.
    I don't know what I’d do without it, Thanks

    I read the other threads just to get ideas

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recorded macro gets formula error

    You should get out of the habit of selecting, just send your commands directly to sheets/cells. Here are some example excerpts from your workbook that can be slimmed down as shown:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recorded macro gets formula error

    I applied must of your suggestions, but the original error came back
    I’m attaching a test file for your reference. And I am including some sample drainage Report files. I will add the Alignment Clearance Reports in another Reply

    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recorded macro gets formula error

    The up-loader program for the Forum can’t see the Alignment Clearance Report file as they are created (html format). So I saved them to text files so that you could see the data, but they won’t work as they are, I edited Alignment A so it would be easier to read, the others are as is from the html file. I hope this helps those how are helping or trying to learn from this,
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Recorded macro gets formula error

    I am hoping that someone will review the code again. I am still getting the 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