commit d7deb1c242f90342c8baf8b251cd7cee24e88c5a Author: Dan Howe Date: Thu Mar 21 13:52:05 2019 +1100 Initial commit (V2 12) diff --git a/costing-tool-module-1.vbs b/costing-tool-module-1.vbs new file mode 100644 index 0000000..773c570 --- /dev/null +++ b/costing-tool-module-1.vbs @@ -0,0 +1,228 @@ +Sub R_More_50() +' +' R_More_50 Macro +' + Range("G2").Select + ActiveCell.FormulaR1C1 = "0.10" + Range("I2").Select + ActiveCell.FormulaR1C1 = "0.35" + ' MsgBox Application.Caller - use this to check what the option button is called + + +End Sub +Sub R_Less_50() +' +' R_Less_50 Macro + + ' Check if worksheet is unlocked + X = False + ' MsgBox Application.Caller - use this to check what the option button is called + + If ActiveSheet.ProtectContents Then X = True + If ActiveSheet.ProtectDrawingObjects Then X = True + If ActiveSheet.ProtectScenarios Then X = True + + If X = False Then + Range("G2").Select + ActiveCell.FormulaR1C1 = "0.25" + Range("I2").Select + ActiveCell.FormulaR1C1 = "0.50" + Else + MsgBox "The worksheet is protected please unlock worksheet to select this option." & vbNewLine & "Please see the WRL Manager Mr Grantley Smith" + ActiveSheet.Shapes("Option Button 42").ControlFormat.Value = 1 + End If + + +End Sub +Sub copytemp() +' +' copytemp Macro +' + Application.ScreenUpdating = False + + ' user promt to create a new sheet + + Dim projectname As String + Range("G3").Select + projectname = InputBox(Prompt:="Enter Project Name", _ + Title:="Project Name", Default:=ActiveCell.Value) + + 'unhide sheets + Sheets("StaffDetails").Visible = False + Sheets("Salary Information").Visible = False + Sheets("RPU Budget_Template").Visible = True + + Sheets("RPU Budget_Template").Select + Sheets("RPU Budget_Template").Copy After:=Sheets(3) + Sheets("RPU Budget_Template (2)").Select + Sheets("RPU Budget_Template (2)").Name = projectname + + Sheets("Project Information").Select + Range("D1").Select + Selection.Copy + + Sheets(projectname).Select + +' adds project details + Range("B3").Select + Application.CutCopyMode = False + ActiveCell.FormulaR1C1 = "='Project Information'!R[-2]C[2]" + Range("B4:E4").Select + ActiveCell.FormulaR1C1 = "='Project Information'!R[2]C[2]" + Range("B5").Select + ActiveCell.FormulaR1C1 = "='Project Information'!R[-1]C[2]" + Range("D5").Select + ActiveCell.FormulaR1C1 = "='Project Information'!RC:RC[3]" + Range("F1").Select + +'adds generation timestamp + ActiveCell.FormulaR1C1 = "=NOW()" + Range("F2").Select + +'copy staff + Sheets("Project Information").Select + Range("D13:J13").Select + Selection.Copy + Sheets(projectname).Select + Range("A8").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=True + Range("A18").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=True + Application.CutCopyMode = False + + 'copy salary markup + Sheets("Project Information").Select + Range("D12:J12").Select + Selection.Copy + Sheets(projectname).Select + Range("Q18").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=True + Application.CutCopyMode = False + + + 'copy hours + Sheets("Project Information").Select + Range("D17:J17").Select + Selection.Copy + Sheets(projectname).Select + Range("G18").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=True + ' copy mark up percentage + Sheets("Project Information").Select + Range("I2").Select + Selection.Copy + Sheets(projectname).Select + Range("S18").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + Range("H8").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + Sheets("Project Information").Select + Range("G2").Select + Selection.Copy + Sheets(projectname).Select + Range("S29").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + Range("S37").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + 'Copy subcontractors + Sheets("Project Information").Select + Range("C71:C75").Select + Selection.Copy + Sheets(projectname).Select + Range("A29").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + 'Copy subcontractor prices + Sheets("Project Information").Select + Range("K71:K75").Select + Selection.Copy + Sheets(projectname).Select + Range("C29").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + Range("F29").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + 'Copy subcontractor markups + Sheets("Project Information").Select + Range("J71:J75").Select + Selection.Copy + Sheets(projectname).Select + Range("G29").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + 'Copy expense items + Sheets("Project Information").Select + Range("C78:C92").Select + Selection.Copy + Sheets(projectname).Select + Range("A37").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + Sheets("Project Information").Select + Range("C78:C92").Select + Selection.Copy + Sheets(projectname).Select + Range("C37").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + 'Copy expense prices + Sheets("Project Information").Select + Range("K78:K92").Select + Selection.Copy + Sheets(projectname).Select + Range("D37").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + Range("G37").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + Sheets("Project Information").Select + Range("A1").Select + Sheets(projectname).Select + Range("A1").Select + + 'Copy expense price markups + + Sheets("Project Information").Select + Range("J78:J92").Select + Selection.Copy + Sheets(projectname).Select + Range("H37").Select + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + + Sheets(projectname).Select + Range("A1").Select + 'ProtectSheet + ActiveSheet.Protect AllowInsertingColumns:=False, _ + AllowInsertingRows:=False, _ + AllowDeletingColumns:=False, _ + AllowDeletingRows:=False + + + Sheets("Project Information").Select + Range("A1").Select + + + ' hides sheets + Sheets("StaffDetails").Visible = False + Sheets("Salary Information").Visible = False + Sheets("RPU Budget_Template").Visible = False + + +End Sub diff --git a/costing-tool-module-3.vbs b/costing-tool-module-3.vbs new file mode 100644 index 0000000..43f427d --- /dev/null +++ b/costing-tool-module-3.vbs @@ -0,0 +1,18 @@ +Sub Export_Values() +' +' Export_Values Macro + Dim projectinfo As String + Range("O1").Select + projectinfo = ActiveCell.Value + + Columns("A:M").Select + Selection.Copy + Workbooks.Add + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ + :=False, Transpose:=False + Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ + SkipBlanks:=False, Transpose:=False + Sheets("Sheet1").Select + Sheets("Sheet1").Name = projectinfo + +End Sub diff --git a/costing-tool-module-4.vbs b/costing-tool-module-4.vbs new file mode 100644 index 0000000..be386c2 --- /dev/null +++ b/costing-tool-module-4.vbs @@ -0,0 +1,17 @@ +Sub Copy_Projectinfo() +' +' Copy_Projectinfo Macro +' Sheets("Project Information").Select + Sheets("Copy_Projectinfo").Visible = True + Sheets("Project Information").Select + Range("B11:K85").Select + Selection.Copy + Sheets("Copy_Projectinfo").Select + Range("A1").Select + ActiveSheet.Paste + Range("L1").Select + Sheets("Project Information").Select + ActiveWindow.SmallScroll Down:=-51 + Range("B1").Select + Application.CutCopyMode = False +End Sub