Sei sulla pagina 1di 12

Sub newProgramEntry()

' macro to insert more rows for entering a new NPI program
' into the Cylinder NPI Resource Management tool

' Macro written 11/10/2010 by Harshil Patel


' Unprotect the main worksheet
Sheets("main").Unprotect Password:="edit"

' Clear out the worksheet 'main'


Sheets("main").Activate
ActiveSheet.Range("A3:IV65536").Select
Selection.Delete Shift:=xlToLeft

' Delete all the old pivot tables and charts


Sheets("Budget (table)").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Budget (chart)").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Resources (table)").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Resources (chart)").Select
ActiveWindow.SelectedSheets.Delete

Sheets("All Programs (master)").Activate


ActiveSheet.Select

' establish the bounds of the dataset


lastRow = Range("A65536").End(xlUp).Row
lastCol = Range("IV1").End(xlToLeft).Column

' select the contents of the master NPI list and copy them to a new worksheet
Range(Cells(2, 2), Cells(lastRow, lastCol)).Select
Selection.Copy
Sheets("main").Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False

Sheets("main").Activate
ActiveSheet.Select

' Insert extra rows for each of the different programs


thisDecember = "12/1/" & DatePart("yyyy", Date)
monthsRemainingTotal = DateDiff("m", Date, #12/1/2015#) + 1
yearsTotal = DateDiff("yyyy", Date, #12/1/2015#) + 1

entriesAdded = monthsRemainingTotal + yearsTotal


entriesAdjusted = entriesAdded + 1

lastRowDates = Range("A65536").End(xlUp).Row
For j = 0 To lastRowDates - 3
Cells((j * entriesAdded) + 3, 32).Value = Month(Date) & "/1/" & Year(Date)
For i = (j * entriesAdded) + 3 To (j * entriesAdded) + entriesAdjusted
If Len(Cells(i, 32).Value) <> 4 And Cells(i, 32).Value <> 2015 Then
Cells(i + 1, 32).Select
Selection.EntireRow.Insert
If Left(Cells(i, 32).Value, 2) <> 12 Then
Cells(i + 1, 32).Value = DateAdd("m", 1, Cells(i, 32).Value)
ElseIf Left(Cells(i, 32).Value, 2) = 12 Then
Cells(i + 1, 32).Value = Right(Cells(i, 32).Value, 4)
Cells(i + 1, 32).NumberFormat = "General"
End If
ElseIf Cells(i, 32).Value = 2015 Then
Cells(i + 1, 32).Value = Month(Date) & "/1/" & Year(Date)
Else
Cells(i + 1, 32).Select
Selection.EntireRow.Insert
Cells(i + 1, 32).Value = DateAdd("m", 1, Cells(i - 1, 32).Value)
End If
' Application.Wait Now + TimeValue("00:00:01")
Range(Cells(i, 1), Cells(i, 20)).Select
Selection.Copy
Cells(i + 1, 1).Select
ActiveSheet.Paste
Next i
Next j

newLastRow = Range("A65536").End(xlUp).Row

Range("A1:AR" & newLastRow).Select


Selection.borders(xlDiagonalDown).LineStyle = xlNone
Selection.borders(xlDiagonalUp).LineStyle = xlNone
With Selection.borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Range("A1:AR3").Select
Selection.Columns.AutoFit

Range("A3").Select
ActiveWindow.FreezePanes = True

Call calculateMain

End Sub

Sub calculateMain()

Sheets("main").Activate
ActiveSheet.Select

activeGate = 9

lastDataRow = Range("A65536").End(xlUp).Row

For i = 3 To lastDataRow

quantIFCyl = Cells(i, 4).Value


quantPFCyl = Cells(i, 5).Value

DesignHoursIF = 0
DetailHoursIF = 0
PMHoursIF = 0

DesignHoursPF = 0
DetailHoursPF = 0
PMHoursPF = 0

hourModelIF = Cells(i, 6).Value


hourModelPF = Cells(i, 7).Value

Select Case hourModelIF


Case "A"
ifModVariance = 20
Case "B"
ifModVariance = 29
Case "C"
ifModVariance = 38
Case "D"
ifModVariance = 47
End Select

Select Case hourModelPF


Case "E"
pfModVariance = 20
Case "F"
pfModVariance = 29
End Select

For x = 1 To quantIFCyl
Select Case x
Case 1
DesignHoursIF = DesignHoursIF + Sheets("Rates & Hours").Cells(ifModVariance,
3).Value
DetailHoursIF = DetailHoursIF + Sheets("Rates & Hours").Cells(ifModVariance, 4).Value
PMHoursIF = PMHoursIF + Sheets("Rates & Hours").Cells(ifModVariance, 5).Value
Case 2
DesignHoursIF = DesignHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 1,
3).Value
DetailHoursIF = DetailHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 1,
4).Value
PMHoursIF = PMHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 1, 5).Value
Case 3
DesignHoursIF = DesignHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 2,
3).Value
DetailHoursIF = DetailHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 2,
4).Value
PMHoursIF = PMHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 2, 5).Value
Case 4
DesignHoursIF = DesignHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 3,
3).Value
DetailHoursIF = DetailHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 3,
4).Value
PMHoursIF = PMHoursIF + Sheets("Rates & Hours").Cells(ifModVariance + 3, 5).Value
Case Else
DesignHoursIF = DesignHoursIF + (Sheets("Rates & Hours").Cells(ifModVariance + 4,
3).Value * (quantIFCyl - 5))
DetailHoursIF = DetailHoursIF + (Sheets("Rates & Hours").Cells(ifModVariance + 4,
4).Value * (quantIFCyl - 5))
PMHoursIF = PMHoursIF + (Sheets("Rates & Hours").Cells(ifModVariance + 4, 5).Value
* (quantIFCyl - 5))
End Select
Next x

For x = 1 To quantPFCyl
Select Case x
Case 1
DesignHoursPF = DesignHoursPF + Sheets("Rates & Hours").Cells(pfModVariance,
8).Value
DetailHoursPF = DetailHoursPF + Sheets("Rates & Hours").Cells(pfModVariance,
9).Value
PMHoursPF = PMHoursPF + Sheets("Rates & Hours").Cells(pfModVariance, 10).Value
Case 2
DesignHoursPF = DesignHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 1,
8).Value
DetailHoursPF = DetailHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 1,
9).Value
PMHoursPF = PMHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 1,
10).Value
Case 3
DesignHoursPF = DesignHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 2,
8).Value
DetailHoursPF = DetailHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 2,
9).Value
PMHoursPF = PMHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 2,
10).Value
Case 4
DesignHoursPF = DesignHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 3,
8).Value
DetailHoursPF = DetailHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 3,
9).Value
PMHoursPF = PMHoursPF + Sheets("Rates & Hours").Cells(pfModVariance + 3,
10).Value
Case Else
DesignHoursPF = DesignHoursPF + (Sheets("Rates & Hours").Cells(pfModVariance + 4,
8).Value * (quantPFCyl - 5))
DetailHoursPF = DetailHoursPF + (Sheets("Rates & Hours").Cells(pfModVariance + 4,
9).Value * (quantPFCyl - 5))
PMHoursPF = PMHoursPF + (Sheets("Rates & Hours").Cells(pfModVariance + 4,
10).Value * (quantPFCyl - 5))
End Select
Next x

' Breakdown of hours by function (design, detail, PM)


Cells(i, 21).Value = DesignHoursIF + DesignHoursPF
Cells(i, 22).Value = DetailHoursIF + DetailHoursPF
Cells(i, 23).Value = PMHoursIF + PMHoursPF

' Total hours


Cells(i, 24).Value = Cells(i, 21).Value + Cells(i, 22).Value + Cells(i, 23).Value

' Breakdown of cost by function


Cells(i, 25).Value = CCur(Cells(i, 21).Value * Range("hrRateDesign").Value)
Cells(i, 26).Value = CCur(Cells(i, 22).Value * Range("hrRateDetail").Value)
Cells(i, 27).Value = CCur(Cells(i, 23).Value * Range("hrRatePM").Value)

' Total cost


Cells(i, 31).Value = CCur(Application.WorksheetFunction.Sum(Range(Cells(i, 23), Cells(i, 28))))

If Len(Cells(i, 32).Value) = 4 Then


Select Case Cells(i, 32).Value
Case 2010
Cells(i, 33).Value = "-"
Cells(i, 34).Value = Application.WorksheetFunction.Sum(Range("AH" & i - 2 & ":AH" & i
- 1))
Cells(i, 35).Value = Application.WorksheetFunction.Sum(Range("AI" & i - 2 & ":AI" & i -
1))
Cells(i, 36).Value = Application.WorksheetFunction.Sum(Range("AJ" & i - 2 & ":AJ" & i -
1))
Case 2011
Cells(i, 33).Value = "-"
Cells(i, 34).Value = Application.WorksheetFunction.Sum(Range("AH" & i - 12 & ":AH" &
i - 1))
Cells(i, 35).Value = Application.WorksheetFunction.Sum(Range("AI" & i - 12 & ":AI" & i -
1))
Cells(i, 36).Value = Application.WorksheetFunction.Sum(Range("AJ" & i - 12 & ":AJ" & i -
1))
Case 2012
Cells(i, 33).Value = "-"
Cells(i, 34).Value = Application.WorksheetFunction.Sum(Range("AH" & i - 12 & ":AH" &
i - 1))
Cells(i, 35).Value = Application.WorksheetFunction.Sum(Range("AI" & i - 12 & ":AI" & i -
1))
Cells(i, 36).Value = Application.WorksheetFunction.Sum(Range("AJ" & i - 12 & ":AJ" & i -
1))
Case 2013
Cells(i, 33).Value = "-"
Cells(i, 34).Value = Application.WorksheetFunction.Sum(Range("AH" & i - 12 & ":AH" &
i - 1))
Cells(i, 35).Value = Application.WorksheetFunction.Sum(Range("AI" & i - 12 & ":AI" & i -
1))
Cells(i, 36).Value = Application.WorksheetFunction.Sum(Range("AJ" & i - 12 & ":AJ" & i -
1))
Case 2014
Cells(i, 33).Value = "-"
Cells(i, 34).Value = Application.WorksheetFunction.Sum(Range("AH" & i - 12 & ":AH" &
i - 1))
Cells(i, 35).Value = Application.WorksheetFunction.Sum(Range("AI" & i - 12 & ":AI" & i -
1))
Cells(i, 36).Value = Application.WorksheetFunction.Sum(Range("AJ" & i - 12 & ":AJ" & i -
1))
Case 2015
Cells(i, 33).Value = "-"
Cells(i, 34).Value = Application.WorksheetFunction.Sum(Range("AH" & i - 12 & ":AH" &
i - 1))
Cells(i, 35).Value = Application.WorksheetFunction.Sum(Range("AI" & i - 12 & ":AI" & i -
1))
Cells(i, 36).Value = Application.WorksheetFunction.Sum(Range("AJ" & i - 12 & ":AJ" & i -
1))
End Select
Else
Cells(i, 9).Select
For j = 9 To 15
If DateDiff("m", ActiveCell.Value, Cells(i, 32).Value) >= 0 And
Application.WorksheetFunction.Sum(Range(Cells(i, j), Cells(i, 15))) > 0 Then
ActiveCell.Offset(0, 1).Select
activeGate = ActiveCell.Column
Else
activeGate = ActiveCell.Column
End If
Next j

Select Case activeGate


Case 9 ' gate 2
Cells(i, 33).Value = activeGate - 7
Cells(i, 34).Value = Round(((Cells(i, 24).Value * Range("designGW1").Value) + (Cells(i,
24).Value * Range("designGW2").Value)) / DateDiff("m", Date, Cells(i, 9).Value), 2) ' design
Cells(i, 35).Value = Round(((Cells(i, 24).Value * Range("detailGW1").Value) + (Cells(i,
24).Value * Range("detailGW2").Value)) / DateDiff("m", Date, Cells(i, 9).Value), 2) ' detail
Cells(i, 36).Value = Round(((Cells(i, 24).Value * Range("pmGW1").Value) + (Cells(i,
24).Value * Range("pmGW2").Value)) / DateDiff("m", Date, Cells(i, 9).Value), 2) 'project
management
Case 10 ' gate 3
Cells(i, 33).Value = activeGate - 7
Cells(i, 34).Value = Round((Cells(i, 24).Value * Range("designGW3").Value) /
DateDiff("m", Cells(i, 9).Value, Cells(i, 10).Value), 2) ' design
Cells(i, 35).Value = Round((Cells(i, 24).Value * Range("detailGW3").Value) / DateDiff("m",
Cells(i, 9).Value, Cells(i, 10).Value), 2) ' detail
Cells(i, 36).Value = Round((Cells(i, 24).Value * Range("pmGW3").Value) / DateDiff("m",
Cells(i, 9).Value, Cells(i, 10).Value), 2) 'project management
Case 11 ' gate 4
Cells(i, 33).Value = activeGate - 7
Cells(i, 34).Value = Round((Cells(i, 24).Value * Range("designGW4").Value) /
DateDiff("m", Cells(i, 10).Value, Cells(i, 11).Value), 2) ' design
Cells(i, 35).Value = Round((Cells(i, 24).Value * Range("detailGW4").Value) / DateDiff("m",
Cells(i, 10).Value, Cells(i, 11).Value), 2) ' detail
Cells(i, 36).Value = Round((Cells(i, 24).Value * Range("pmGW4").Value) / DateDiff("m",
Cells(i, 10).Value, Cells(i, 11).Value), 2) 'project management
Case 12 ' gate 5
Cells(i, 33).Value = activeGate - 7
Cells(i, 34).Value = Round((Cells(i, 24).Value * Range("designGW5").Value) /
DateDiff("m", Cells(i, 11).Value, Cells(i, 12).Value), 2) ' design
Cells(i, 35).Value = Round((Cells(i, 24).Value * Range("detailGW5").Value) / DateDiff("m",
Cells(i, 11).Value, Cells(i, 12).Value), 2) ' detail
Cells(i, 36).Value = Round((Cells(i, 24).Value * Range("pmGW5").Value) / DateDiff("m",
Cells(i, 11).Value, Cells(i, 12).Value), 2) 'project management
Case 13 'gate 5.5
Cells(i, 33).Value = activeGate - 7.5
Cells(i, 34).Value = Round((Cells(i, 24).Value * Range("designGW55").Value) /
DateDiff("m", Cells(i, 12).Value, Cells(i, 13).Value), 2) ' design
Cells(i, 35).Value = Round((Cells(i, 24).Value * Range("detailGW55").Value) /
DateDiff("m", Cells(i, 12).Value, Cells(i, 13).Value), 2) ' detail
Cells(i, 36).Value = Round((Cells(i, 24).Value * Range("pmGW55").Value) / DateDiff("m",
Cells(i, 12).Value, Cells(i, 13).Value), 2) 'project management
Case 14 ' gate 6
Cells(i, 33).Value = activeGate - 8
Cells(i, 34).Value = Round((Cells(i, 24).Value * Range("designGW6").Value) /
DateDiff("m", Cells(i, 13).Value, Cells(i, 14).Value), 2) ' design
Cells(i, 35).Value = Round((Cells(i, 24).Value * Range("detailGW6").Value) / DateDiff("m",
Cells(i, 13).Value, Cells(i, 14).Value), 2) ' detail
Cells(i, 36).Value = Round((Cells(i, 24).Value * Range("pmGW6").Value) / DateDiff("m",
Cells(i, 13).Value, Cells(i, 14).Value), 2) 'project management
Case Else ' gate 7
If activeGate > 15 Then
Cells(i, 33).Value = "End"
Else
Cells(i, 33).Value = activeGate - 8
End If
Cells(i, 34).Value = Round((Cells(i, 24).Value * Range("designGW7").Value) /
DateDiff("m", Cells(i, 14).Value, Cells(i, 15).Value), 2) ' design
Cells(i, 35).Value = Round((Cells(i, 24).Value * Range("detailGW7").Value) / DateDiff("m",
Cells(i, 14).Value, Cells(i, 15).Value), 2) ' detail
Cells(i, 36).Value = Round((Cells(i, 24).Value * Range("pmGW7").Value) / DateDiff("m",
Cells(i, 14).Value, Cells(i, 15).Value), 2) 'project management
End Select

End If

' Total hours


Cells(i, 37).Value = Round(Cells(i, 36).Value + Cells(i, 35).Value + Cells(i, 34).Value, 2)

' Resources required


Cells(i, 38).Value = Round(Cells(i, 34) / 176, 2)
Cells(i, 39).Value = Round(Cells(i, 35) / 176, 2)
Cells(i, 40).Value = Round(Cells(i, 36) / 176, 2)

' Budget required


Cells(i, 41).Value = CCur(Round(Cells(i, 34) * Range("hrRateDesign").Value, 2))
Cells(i, 42).Value = CCur(Round(Cells(i, 35) * Range("hrRateDetail").Value, 2))
Cells(i, 43).Value = CCur(Round(Cells(i, 36) * Range("hrRatePM").Value, 2))

' Total budget


Cells(i, 44).Value = CCur(Round(Cells(i, 41).Value + Cells(i, 42).Value + Cells(i, 43).Value, 2))
Next i

Call createPivots

End Sub

Sub printNPIProgramList()
'
' printNPIProgramList Macro
' Macro recorded 11/23/2010 by patelh22
'
'

Sheets("All Programs (master)").Activate


ActiveSheet.Select

finalRow = Range("A65536").End(xlUp).Row

Range("A1:R" & finalRow).Select


With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 2
.PrintErrors = xlPrintErrorsDisplayed
End With
Selection.PrintOut Copies:=1, Collate:=True

Sheets("Controls & Help").Activate


ActiveSheet.Select

MsgBox "The list was sent to the default printer"

End Sub
Sub createPivots()
'
' createPivots Macro
' Macro recorded 12/6/2010 by patelh22
'

'

Sheets("main").Select
lastRow = Range("A65536").End(xlUp).Row
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"main!R2C1:R" & lastRow & "C44").CreatePivotTable TableDestination:="", TableName:= _
"ResourcesRequired", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("ResourcesRequired").AddFields RowFields:=Array( _
"Month", "Data"), ColumnFields:="Project Name", PageFields:= _
"Project Manager"
With ActiveSheet.PivotTables("ResourcesRequired").PivotFields("Design Resource" _
)
.Orientation = xlDataField
.Position = 1
End With
With ActiveSheet.PivotTables("ResourcesRequired").PivotFields( _
"Detailing Resource")
.Orientation = xlDataField
.Position = 2
End With
ActiveSheet.Name = "Resources (table)"
ActiveSheet.PivotTables("ResourcesRequired").PivotFields("PM Resource"). _
Orientation = xlDataField
Charts.Add
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart.PivotLayout.PivotTable.PivotFields("Month")
.PivotItems("12/1/2010").Visible = False
.PivotItems("1/1/2011").Visible = False
.PivotItems("2/1/2011").Visible = False
.PivotItems("3/1/2011").Visible = False
.PivotItems("4/1/2011").Visible = False
.PivotItems("5/1/2011").Visible = False
.PivotItems("6/1/2011").Visible = False
.PivotItems("7/1/2011").Visible = False
.PivotItems("8/1/2011").Visible = False
.PivotItems("9/1/2011").Visible = False
.PivotItems("10/1/2011").Visible = False
.PivotItems("11/1/2011").Visible = False
.PivotItems("12/1/2011").Visible = False
.PivotItems("1/1/2012").Visible = False
.PivotItems("2/1/2012").Visible = False
.PivotItems("3/1/2012").Visible = False
.PivotItems("4/1/2012").Visible = False
.PivotItems("5/1/2012").Visible = False
.PivotItems("6/1/2012").Visible = False
.PivotItems("7/1/2012").Visible = False
.PivotItems("8/1/2012").Visible = False
.PivotItems("9/1/2012").Visible = False
.PivotItems("10/1/2012").Visible = False
.PivotItems("11/1/2012").Visible = False
.PivotItems("12/1/2012").Visible = False
.PivotItems("1/1/2013").Visible = False
.PivotItems("2/1/2013").Visible = False
.PivotItems("3/1/2013").Visible = False
.PivotItems("4/1/2013").Visible = False
.PivotItems("5/1/2013").Visible = False
.PivotItems("6/1/2013").Visible = False
.PivotItems("7/1/2013").Visible = False
.PivotItems("8/1/2013").Visible = False
.PivotItems("9/1/2013").Visible = False
.PivotItems("10/1/2013").Visible = False
.PivotItems("11/1/2013").Visible = False
.PivotItems("12/1/2013").Visible = False
.PivotItems("1/1/2014").Visible = False
End With
With ActiveChart.PivotLayout.PivotTable.PivotFields("Month")
.PivotItems("2/1/2014").Visible = False
.PivotItems("3/1/2014").Visible = False
.PivotItems("4/1/2014").Visible = False
.PivotItems("5/1/2014").Visible = False
.PivotItems("6/1/2014").Visible = False
.PivotItems("7/1/2014").Visible = False
.PivotItems("8/1/2014").Visible = False
.PivotItems("9/1/2014").Visible = False
.PivotItems("10/1/2014").Visible = False
.PivotItems("11/1/2014").Visible = False
.PivotItems("12/1/2014").Visible = False
.PivotItems("1/1/2015").Visible = False
.PivotItems("2/1/2015").Visible = False
.PivotItems("3/1/2015").Visible = False
.PivotItems("4/1/2015").Visible = False
.PivotItems("5/1/2015").Visible = False
.PivotItems("6/1/2015").Visible = False
.PivotItems("7/1/2015").Visible = False
.PivotItems("8/1/2015").Visible = False
.PivotItems("9/1/2015").Visible = False
.PivotItems("10/1/2015").Visible = False
.PivotItems("11/1/2015").Visible = False
.PivotItems("12/1/2015").Visible = False
End With
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = 0
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
ActiveSheet.Name = "Resources (chart)"
Sheets("main").Select
ActiveWorkbook.Worksheets("Resources (table)").PivotTables("ResourcesRequired") _
.PivotCache.CreatePivotTable TableDestination:="", TableName:= _
"BudgetRequired", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("BudgetRequired").AddFields RowFields:=Array("Month", _
"Data"), ColumnFields:="Project Name", PageFields:="Project Manager"
With ActiveSheet.PivotTables("BudgetRequired").PivotFields("Design Cost")
.Orientation = xlDataField
.Position = 1
End With
With ActiveSheet.PivotTables("BudgetRequired").PivotFields("Detailing Cost")
.Orientation = xlDataField
.Position = 2
End With
ActiveSheet.PivotTables("BudgetRequired").PivotFields("PM Cost").Orientation = _
xlDataField
ActiveSheet.Name = "Budget (table)"
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Budget (table)").Range("A3")
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart.PivotLayout.PivotTable.PivotFields("Month")
.PivotItems("12/1/2010").Visible = False
.PivotItems("1/1/2011").Visible = False
.PivotItems("2/1/2011").Visible = False
.PivotItems("3/1/2011").Visible = False
.PivotItems("4/1/2011").Visible = False
.PivotItems("5/1/2011").Visible = False
.PivotItems("6/1/2011").Visible = False
.PivotItems("7/1/2011").Visible = False
.PivotItems("8/1/2011").Visible = False
.PivotItems("9/1/2011").Visible = False
.PivotItems("10/1/2011").Visible = False
.PivotItems("11/1/2011").Visible = False
.PivotItems("12/1/2011").Visible = False
.PivotItems("1/1/2012").Visible = False
.PivotItems("2/1/2012").Visible = False
.PivotItems("3/1/2012").Visible = False
.PivotItems("4/1/2012").Visible = False
.PivotItems("5/1/2012").Visible = False
.PivotItems("6/1/2012").Visible = False
.PivotItems("7/1/2012").Visible = False
.PivotItems("8/1/2012").Visible = False
.PivotItems("9/1/2012").Visible = False
.PivotItems("10/1/2012").Visible = False
.PivotItems("11/1/2012").Visible = False
.PivotItems("12/1/2012").Visible = False
.PivotItems("1/1/2013").Visible = False
.PivotItems("2/1/2013").Visible = False
.PivotItems("3/1/2013").Visible = False
.PivotItems("4/1/2013").Visible = False
.PivotItems("5/1/2013").Visible = False
.PivotItems("6/1/2013").Visible = False
.PivotItems("7/1/2013").Visible = False
.PivotItems("8/1/2013").Visible = False
.PivotItems("9/1/2013").Visible = False
.PivotItems("10/1/2013").Visible = False
.PivotItems("11/1/2013").Visible = False
.PivotItems("12/1/2013").Visible = False
.PivotItems("1/1/2014").Visible = False
End With
With ActiveChart.PivotLayout.PivotTable.PivotFields("Month")
.PivotItems("2/1/2014").Visible = False
.PivotItems("3/1/2014").Visible = False
.PivotItems("4/1/2014").Visible = False
.PivotItems("5/1/2014").Visible = False
.PivotItems("6/1/2014").Visible = False
.PivotItems("7/1/2014").Visible = False
.PivotItems("8/1/2014").Visible = False
.PivotItems("9/1/2014").Visible = False
.PivotItems("10/1/2014").Visible = False
.PivotItems("11/1/2014").Visible = False
.PivotItems("12/1/2014").Visible = False
.PivotItems("1/1/2015").Visible = False
.PivotItems("2/1/2015").Visible = False
.PivotItems("3/1/2015").Visible = False
.PivotItems("4/1/2015").Visible = False
.PivotItems("5/1/2015").Visible = False
.PivotItems("6/1/2015").Visible = False
.PivotItems("7/1/2015").Visible = False
.PivotItems("8/1/2015").Visible = False
.PivotItems("9/1/2015").Visible = False
.PivotItems("10/1/2015").Visible = False
.PivotItems("11/1/2015").Visible = False
.PivotItems("12/1/2015").Visible = False
End With
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = 0
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
ActiveSheet.Name = "Budget (chart)"

Sheets("main").Protect Password:="edit"

Sheets("Controls & Help").Activate


ActiveSheet.Select

MsgBox "The update has completed!"

End Sub