You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
costing-tool/costing-tool-module-1.vbs

207 lines
6.3 KiB
Plaintext

5 years ago
Sub MECR_35()
'
' R_More_50 Macro
'
Range("G2").Select
ActiveCell.FormulaR1C1 = "0.35"
' MsgBox Application.Caller - use this to check what the option button is called
End Sub
5 years ago
Sub MECR_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.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
5 years ago
'creates a copy of the "project template" with the project name to start pasting information
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
5 years ago
' 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
5 years ago
'adds generation timestamp
ActiveCell.FormulaR1C1 = "=NOW()"
Range("F2").Select
5 years ago
'copy staff
Sheets("Project Information").Select
Range("D13:M13").Select
Selection.Copy
Sheets(projectname).Select
Range("A8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Range("A21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
5 years ago
'copy salary markup
Sheets("Project Information").Select
Range("D12:M12").Select
Selection.Copy
Sheets(projectname).Select
5 years ago
Range("T21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
5 years ago
'copy hours
Sheets("Project Information").Select
Range("D17:M17").Select
Selection.Copy
Sheets(projectname).Select
Range("G21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
5 years ago
'Copy subcontractors
Sheets("Project Information").Select
Range("C71:C75").Select
Selection.Copy
Sheets(projectname).Select
Range("A35").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
5 years ago
'Copy subcontractor prices
Sheets("Project Information").Select
Range("N71:N75").Select
Selection.Copy
Sheets(projectname).Select
Range("C35").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F35").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
5 years ago
'Copy subcontractor markups
Sheets("Project Information").Select
Range("M71:M75").Select
Selection.Copy
Sheets(projectname).Select
Range("G35").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
5 years ago
'Copy expense items
Sheets("Project Information").Select
Range("C78:C92").Select
Selection.Copy
Sheets(projectname).Select
Range("A43").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("C43").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
5 years ago
'Copy expense prices
Sheets("Project Information").Select
Range("N78:N92").Select
Selection.Copy
Sheets(projectname).Select
Range("D43").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("G43").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Project Information").Select
Range("A1").Select
Sheets(projectname).Select
Range("A1").Select
5 years ago
'Copy expense price markups
Sheets("Project Information").Select
Range("M78:M92").Select
Selection.Copy
Sheets(projectname).Select
Range("H43").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets(projectname).Select
Range("A1").Select
5 years ago
' hides sheets
Sheets("StaffDetails").Visible = False
Sheets("Salary Information").Visible = False
Sheets("RPU Budget_Template").Visible = False
'ProtectSheet
ActiveSheet.Protect AllowInsertingColumns:=False, _
AllowInsertingRows:=False, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=False
Sheets("Project Information").Select
Range("A1").Select
5 years ago
Sheets(projectname).Select
Application.Goto Reference:=Range("a1"), Scroll:=True
End Sub