Results 1 to 2 of 2

Insert method of Range class failed

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Insert method of Range class failed

    Here is the line that is giving me problems. This worked absolutely fine yesterday.



    Range("C:D,H:H,L:L,N:N").EntireColumn.Insert
    Here is the code up to this point and a bit beyond:
    Sub RMC_Incurred_Cost_Submission()
        
        Dim lastRow As Long         'this is the number of the last row BEFORE rows are inserted for every change in Account Number (column A)
        Dim cell As Range
        Dim lookup As Range         'this is for the lookup value for the VLOOKUP formula applied to column C
        Dim currentRow As Long      'this will mark the position of the current row when adding blank rows starting from the very bottom
        
        
        firstRow = 1
        lastRow = Range("A1048576").End(xlUp).Row
    
    
        endingYear = Application.InputBox(Prompt:="What year is this Incurred Cost Submission for?")    'Prompt the user for the year of the ICS
        
    
            
        Worksheets(1).Copy After:=Worksheets(2)     'The original data will be copied and become Worksheet #2.  This is where most of the work will be done.
        Worksheets(3).Name = "Working Copy"
        Worksheets.Add(After:=Worksheets(3)).Name = "VLOOKUP"
        Worksheets.Add(After:=Worksheets(4)).Name = "Incurred Cost Submission"
        
        'With Worksheets(4)
            Worksheets(4).Range("A1") = 1                            'Create a VLOOKUP table from (A1:B3)
            Worksheets(4).Range("A2") = 2
            Worksheets(4).Range("A3") = 3
            Worksheets(4).Range("B1") = "Fixed Price"
            Worksheets(4).Range("B2") = "Cost Plus Fixed Fee"
            Worksheets(4).Range("B3") = "Time & Materials"
            Worksheets(4).Range("A1:B3").Name = "vTable"             'Name the VLOOKUP table
        'End With
        
        
        
        
        'Color the last tab orange
        Worksheets(5).Tab.ColorIndex = 45
        
        Worksheets(3).Activate              'Rows, columns and formulas will be inserted on Sheet2.
        Range("A1").CurrentRegion.Sort Key1:=Range("A1"), order1:=xlAscending, Header:=xlYes    'Sort Account numbers in column A
        Range("C:C").Value = Range("C:C").Value     'Convert text numbers to numbers so VLOOKUP will work
        
        
        'Insert columns then add formulas to determine Contract Type (with VLOOKUP), Contract Value, Beginning and Ending Dates
    
        Range("C:D,H:H,L:L,N:N").EntireColumn.Insert
    
        
        'Create column names from A1:T1
        
        Range("A1") = "JOB#"
        Range("B1") = "TASK NO"
        Range("C1") = "CTR TYPE"
        Range("D1") = "AGENCY TYPE"
        Range("E1") = "CONTRACT TYPE NO"

    Why am I receiving this error? I must be overlooking something.
    Last edited by Leith Ross; 12-28-2013 at 12:54 AM. Reason: Highlighted Problem Line

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Insert Row throws error "Insert Method of Range class failed"
    By bg_enigma1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2015, 11:30 AM
  2. Help - Insert method of Range class failed - Selection.Insert Shift:=xlToRight
    By sandy@excelforum in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-04-2012, 11:14 AM
  3. "Insert method of Range class failed" in Shared mode
    By BartDeHertogh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2012, 03:50 PM
  4. Runtime error 1004: Insert method of Range class failed......not sure why
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-21-2011, 02:15 PM
  5. Insert Method of Range Class Failed
    By amarendra19 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-24-2011, 12:32 PM

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