' pick up calcs from each milestone
Dim A As Integer
Dim B As Integer
For A = 1 To 12
Range("A1").Select
Selection.End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "Completed"
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
Selection.Offset(1, 0).Activate
' on target
ActiveCell.FormulaR1C1 = "On Target"
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
Selection.Offset(1, 0).Activate
' Close to late
ActiveCell.FormulaR1C1 = "Close to Late"
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
Selection.Offset(1, 0).Activate
' Late
ActiveCell.FormulaR1C1 = "Late"
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
Selection.Offset(1, 0).Activate
'Open Milestones
ActiveCell.FormulaR1C1 = "Open Milestones"
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
Selection.Offset(1, 0).Activate
'Avg Open Milestones
ActiveCell.FormulaR1C1 = "Avg Open Milestones"
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
Selection.Offset(-5, 1).Activate
' Begin ColorCount
'Grey
ActiveCell.FormulaR1C1 = "=cgrey(R[-37]C:R[-1]C)"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
ActiveCell.Offset(1, 0).Activate
'Green
ActiveCell.FormulaR1C1 = "=cgreen(R[-38]C:R[-2]C)"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
ActiveCell.Offset(1, 0).Activate
'Yellow
ActiveCell.FormulaR1C1 = "=cyellow(R[-39]C:R[-3]C)"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
ActiveCell.Offset(1, 0).Activate
'Red
ActiveCell.FormulaR1C1 = "=cred(R[-40]C:R[-4]C)"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Selection.Font.Bold = True
ActiveCell.Offset(-3, 0).Activate
Range(Selection, Selection.End(xlDown)).Copy
'ActiveCell.Offset(0, 1).Activate
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Resize(Selection.Rows.Count - 2, _
Selection.Columns.Count).Select
ActiveSheet.Paste
'Do sum for open milestone
ActiveCell.Offset(4, 0).Activate
ActiveCell.FormulaR1C1 = "=if(SUM(R[-3]C:R[-1]C)=0,"""",SUM(R[-3]C:R[-1]C))"
'ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Selection.Copy
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Resize(Selection.Rows.Count - 1, _
Selection.Columns.Count).Select
ActiveSheet.Paste
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
ActiveCell.Offset(1, 0).Activate
'paste special all formulas
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("C1").Select
Selection.End(xlDown).Select
'for deletion of extra cells
Range("A4").Activate
Selection.End(xlToRight).Offset(0, 1).Activate
'Selection.End(xlToRight).Offset(0, 1).Activate
Range(Selection, Selection.End(xlToRight)).Select
Selection.EntireColumn.Delete
Range("A2").Activate
Selection.End(xlDown).Offset(0, 1).Select
'average
ActiveCell.FormulaR1C1 = "=if(sum(R[-1]C:R[-1]C[33])<1,0,average(R[-1]C:R[-1]C[33]))"
'ActiveCell.FormulaR1C1 = "=AVERAGE(R[-1]C:R[-1]C[33])"
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Selection.NumberFormat = "0"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Commets
Range("A4").Activate
Selection.End(xlToRight).Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "Comments"
Selection.Font.Bold = True
With Selection.Font
.Name = "Tahoma"
.Size = 10
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Cells.Select
Selection.ColumnWidth = 88
Cells.EntireColumn.AutoFit
Cells.EntireRow.AutoFit
Range("A1").Select
ActiveWindow.SmallScroll ToRight:=-7
ActiveSheet.Next.Select
Next A