Results 1 to 10 of 10

Runtime error 1004 - Application Defined or Object Defined Error

Threaded View

  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    OC, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Runtime error 1004 - Application Defined or Object Defined Error

    Hello,

    I get the runtime error in excel 2010 when running a macro for an IF statement/formula. The formula is:

    =IF(AND(A8="4050.000",C8>0),"Over Budget: Line item not budgeted, however late charges billed and collected per the Billing & Collection Policy.",(IF(AND(A8="4050.000",C8<0),"Under Budget: Payment to xx for 50% of collected late fees from prior fiscal years.",(IF(AND(A8="",C8>1),"",(IF(A8="","",(IF(AND(E8>=100,F8>="105.00%"),"Over Budget:",(IF(F8="100.00%","No Variance",(IF(AND(C8<=0,D8>0),"Under Budget: No expense incurred",(IF(AND(C8>0,D8=0),"Over Budget: Line item not budgeted",(IF(AND(F8<"95.00%",E8<=-100),"Under Budget:",(IF(F8="100.00%","No Variance",(IF(AND(F8="0.00%",G8>1),"No Variance",(IF(AND(OR(F8<"100.00%",F8>"95.00%"),OR(E8>-100,E8<100)),"Under Budget: No significant variance","Over Budget: No significant variance")))))))))))))))))))))))

    When I hit debug, it takes me to the VB window and highighlights the formula. I don't know anything about programming so please try to explain in laymans terms for me. The IF statement is 55 words if that's any help.

    Here is the VB code:
    Sub test()
    '
    ' test Macro
    '
    
    '
        ActiveCell.FormulaR1C1 = _
            "=IF(AND(RC[-9]=""4050.000"",RC[-7]>0),""Over Budget: Line item not budgeted, however late charges billed and collected per the Billing & Collection Policy."",(IF(AND(RC[-9]=""4050.000"",RC[-7]<0),""Under Budget: Payment to Mar West for 50% of collected late fees from prior fiscal years."",(IF(AND(RC[-9]="""",RC[-7]>1),"""",(IF(RC[-9]="""","""",(IF(AND(RC[-5]>=100,RC" & _
            "105.00%""),""Over Budget:"",(IF(RC[-4]=""100.00%"",""No Variance"",(IF(AND(RC[-7]<=0,RC[-6]>0),""Under Budget: No expense incurred"",(IF(AND(RC[-7]>0,RC[-6]=0),""Over Budget: Line item not budgeted"",(IF(AND(RC[-4]<""95.00%"",RC[-5]<=-100),""Under Budget:"",(IF(RC[-4]=""100.00%"",""No Variance"",(IF(AND(RC[-4]=""0.00%"",RC[-3]>1),""No Variance"",(IF(AND(OR(RC[-4]<""" & _
            ",RC[-4]>""95.00%""),OR(RC[-5]>-100,RC[-5]<100)),""Under Budget: No significant variance"",""Over Budget: No significant variance"")))))))))))))))))))))))"    Range("J8").Select
        Selection.AutoFill Destination:=Range("J8:J187"), Type:=xlFillDefault
        Range("J8:J187").Select
        Selection.Copy
    Range("H8").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.CutCopyMode = False
        With Selection
            .HorizontalAlignment = xlGeneral
            .VerticalAlignment = xlTop
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        With Selection
            .HorizontalAlignment = xlGeneral
            .VerticalAlignment = xlTop
            .WrapText = True
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        Selection.Rows.AutoFit
    End Sub
    Last edited by davesexcel; 05-18-2012 at 07:31 PM. Reason: Code tags required when showing VBA code, please read the forum rules

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