Results 1 to 2 of 2

Excel 2007 : Run Time Error 1004 when inserting formula

Threaded View

  1. #1
    Registered User
    Join Date
    08-16-2010
    Location
    Atlanta Ga.
    MS-Off Ver
    210
    Posts
    61

    Run Time Error 1004 when inserting formula

    I am trying to add cell formulas using VBA. When the code runs I get a 'Run Time Error 1004' application defined or object defined error. The error occurs where it is inserting the formulas into the cell. I have commented out the first one or two and still get the error. These formulas work when entered in the spreadsheet. The code I am using is below



    'CORRECTS THE NO FLEET ID OR LTR ISSUE
        Sheets("RPT 5").Select
    
        If Range("G5") <> "" Then
        Columns("E:E").Insert
        
        Sheets("Data").Select
    'CLEAR FORMULAS TO INSERT NEW
        
        Range("D4:H504").Select
        Selection.ClearContents
        
       
        Range("D4").Formula = "=IF('RPT 5'!G6>0,('RPT 5'!G6),(""))"
       
        Range("E4").Formula = "=IFERROR(IF(INDEX('MAKE MODEL'!B:G,MATCH(D4,'MAKE MODEL'!B:B,0),6)=0,(""),(INDEX('MAKE MODEL'!B:G,MATCH(D4,'MAKE MODEL'!B:B,0),6))),"")"
        
        Range("F4").Formula = "=IF(D4="",(""),('RPT 5'!A6))"
    
        Range("G4").Formula = "=IF(D4="",(""),('RPT 5'!B6))"
    
        Range("H4").Formula = "=IF(D4="",(""),('RPT 5'!C6))"
        
        
        End If
    Last edited by grsnipe; 09-23-2011 at 10:32 AM.

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