The following is a macro which collects data from data we import into certain tabs. When the macro is run it filters through the data and produces a new excel book with this new data. The person who created this is no longer with us. The macro works fine except I'm trying to add another column like the one that calculates network days called days since 1st auth less parked. Im wanting to add another which gives days since the start of the information being passed to us. Ie a column call 1st instructed less parked.
Sub Runme()
'
' Macro1 Macro
' Macro recorded 22/03/2013'
'
Sheets("CCX data SORTED").Select
Cells.Select
Selection.Delete Shift:=xlUp
Sheets("CCX Data Raw").Select
Range("A:C,E:G").Select
Selection.Delete Shift:=xlToLeft
Rows("1:1").Select
Selection.AutoFilter
Range("H2").Select
Range("A1:X10000").Sort Key1:=Range("H1"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("H55000").End(xlUp)(2, 1).Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToLeft)).Select
Selection.ClearContents
Cells.Select
Selection.Copy
Sheets("CCX data SORTED").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("CCX Data Raw").Select
Cells.Select
Selection.Delete Shift:=xlUp
Sheets("CCX data SORTED").Select
Columns("X:X").Select
Selection.Insert Shift:=xlToRight
Range("X2").Select
ActiveCell.FormulaR1C1 = _
"=IF(VLOOKUP(RC[-23],'SCMT weekly data'!C[-17]:C[-11],7,FALSE)>0,(VLOOKUP(RC[-23],'SCMT weekly data'!C[-17]:C[-11],7,FALSE)),"""")"
Range("X2").Select
Selection.AutoFill Destination:=Range("X2:X5000")
Range("X1").Select
ActiveCell.FormulaR1C1 = "SCMT end Date"
Columns("X:X").Select
Selection.NumberFormat = "m/d/yyyy"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("SCMT Weekly data").Select
Columns("Z:Z").Select
Selection.Insert Shift:=xlToRight
Range("Z1").Select
ActiveCell.FormulaR1C1 = "Days To Exclude 1"
Range("Z2").Select
ActiveCell.FormulaR1C1 = _
"=IF(COUNTA(RC[-2],RC[-1])=2,NETWORKDAYS(RC[-2],RC[-1],'Bank hols'!RC[-25]:R[56]C[-25]),0)"
Selection.AutoFill Destination:=Range("Z2:Z5000"), Type:=xlFillDefault
Columns("AD:AD").Select
Selection.Insert Shift:=xlToRight
Range("AD1").Select
ActiveCell.FormulaR1C1 = "Days To Exclude 2"
Range("AD2").Select
ActiveCell.FormulaR1C1 = _
"=IF(COUNTA(RC[-2],RC[-1])=2,NETWORKDAYS(RC[-2],RC[-1],'Bank hols'!RC[-29]:R[56]C[-29]),0)"
Selection.AutoFill Destination:=Range("AD2:AD5000")
Columns("Z:Z").Select
Selection.NumberFormat = "0"
Columns("AD:AD").Select
Selection.NumberFormat = "0"
Range("AH2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("AF1").Select
ActiveCell.FormulaR1C1 = "Days since first auth"
Range("AF2").Select
ActiveCell.FormulaR1C1 = _
"=IF(COUNTA(RC[-21],R2C34)=2,NETWORKDAYS(RC[-21],R2C34,'Bank hols'!RC[-31]:R[56]C[-31]),"""")"
Range("AG2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISNUMBER(RC[-1]),SUM(RC[-1]-(RC[-3]+RC[-7])),"""")"
Range("AG1").Select
ActiveCell.FormulaR1C1 = "Days since 1st Auth less parked"
Columns("AH:AH").Select
Selection.Insert Shift:=xlToRight
Range("AH1").Select
ActiveCell.FormulaR1C1 = "Still Parked"
Range("AH2").Select
ActiveCell.FormulaR1C1 = _
"=IF(AND(ISNUMBER(RC[-10]),ISBLANK(RC[-9])),""XX"",IF(AND(ISNUMBER(RC[-6]),ISBLANK(RC[-5])),""XX"",""""))"
Selection.AutoFill Destination:=Range("AH2:AH5000")
Range("AF2:AG2").Select
Selection.AutoFill Destination:=Range("AF2:AG5000")
Range("A55000").End(xlUp)(2, 1).Select
Selection.EntireRow.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Sheets("CCX data SORTED").Select
Range("Z1").Select
ActiveCell.FormulaR1C1 = "SCMT Queue"
Range("Z2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-25],'SCMT Daily Drop'!C[-16]:C[-14],3,FALSE)"
Selection.AutoFill Destination:=Range("Z2:Z5000")
Range("AA1").Select
ActiveCell.FormulaR1C1 = "Days Since First Approved"
Range("AA2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1,'SCMT weekly data'!C7:C34,27,FALSE)"
Selection.AutoFill Destination:=Range("AA2:AA5000")
Range("AB1").Select
ActiveCell.FormulaR1C1 = "Still Parked"
Range("AB2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1,'SCMT weekly data'!C7:C34,28,FALSE)"
Selection.AutoFill Destination:=Range("AB2:AB5000")
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A55000").End(xlUp)(2, 1).Select
Selection.EntireRow.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Sheets("SCMT weekly data").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets(Array("SCMT weekly data", "SCMT Daily Drop", "CCX data SORTED")).Select
Sheets("CCX data SORTED").Activate
Sheets(Array("SCMT weekly data", "SCMT Daily Drop", "CCX data SORTED")).Copy
Windows("SCMT Parked.xls").Activate
Sheets("SCMT weekly data").Select
Cells.Select
Selection.Delete Shift:=xlUp
Sheets("SCMT Daily Drop").Select
Cells.Select
Selection.Delete Shift:=xlUp
Sheets("CCX data SORTED").Select
Cells.Select
Selection.Delete Shift:=xlUp
MsgBox ("Macro Complete")
End Sub