Results 1 to 11 of 11

VBA for Inserting Formula returning Run-time error '1004'

Threaded View

  1. #1
    Registered User
    Join Date
    10-10-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    VBA for Inserting Formula returning Run-time error '1004'

    Hello,

    I'm attempting to auto-fill a formula that has been converted to VBA.
    Rather than going through the tedius method of manually rewriting the formula to be filled via VBA, I used the auto-record method.

    Trouble is, rather than running smoothly it is returning the following error before even reaching the auto-fill portion of code:
    "Run-time error '1004':
    Application-defined or object-defined error"

    All my single-line formulas are working just fine, but the following two are getting the same error (I recognize the 2nd is a mammoth. If the problem with the 1st is fixed, I should be able to repair the 2nd on my own):

        Range("O2").FormulaR1C1 = _
            "=IF('Verizon Cells & ACards'!RC13=""Current"",IF(SUMIFS('Verizon Cells & ACards'!C14,'Verizon Cells & ACards'!C3,'Verizon Cells & ACards'!RC3)=VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)+1,0,VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)+1-SUMIFS('Verizon Cells & ACards'!C14" & _
            "n Cells & ACards'!C3,'Verizon Cells & ACards'!RC3)),0)"
    
        Range("N2").FormulaR1C1 = _
            "=IF(ISBLANK(RC7),(VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5))+1,IF(ISBLANK('Verizon Cells & ACards'!RC8),IF('Verizon Cells & ACards'!RC7<(VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)),VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)+1,IF('Verizon Cells & ACards'!RC7>(VLOOKUP" & _
            "y Decl'!R1C2,BillingPeriods,6)),0,VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-'Verizon Cells & ACards'!RC7+1)),IF('Verizon Cells & ACards'!RC8<VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5),0,IF('Verizon Cells & ACards'!RC8>VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6),IF('Verizon Cells & ACards'!RC7>VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6),0,IF('Verizon Cells" & _
            "'!RC7<(VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)),VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)+1,VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6)-'Verizon Cells & ACards'!RC7+1)),IF('Verizon Cells & ACards'!RC7>VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,6),0,IF('Verizon Cells & ACards'!RC7<(VLOOKUP('Cost by Decl'!R1C2," & _
            "riods,5)),'Verizon Cells & ACards'!RC8-(VLOOKUP('Cost by Decl'!R1C2,BillingPeriods,5)),'Verizon Cells & ACards'!RC8-'Verizon Cells & ACards'!RC7+1))))))"
    Any help will be greatly appreciated. And before anyone offers it, I did double-check that it' susing the ..." & _" syntax for long vba code. I couldn't find anything more for multiple lines of code in a formula.
    Last edited by blwager; 12-18-2013 at 04:42 PM. Reason: code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. HELP. I changed my sheet name, and now I keep getting rune time errors!
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 09-21-2013, 06:16 PM
  2. vba code returning Run Time Error 1004 method 'undo' of object
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2012, 08:17 PM
  3. Run Time Error 1004 pasting formula into worksheet using VBA.
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2012, 09:42 PM
  4. Replies: 1
    Last Post: 09-23-2011, 10:35 AM
  5. worksheetfunction.vlookup returning run-time error (1004)
    By Mervil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2010, 01:41 AM

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