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.
Bookmarks