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.
237 lines
7.1 KiB
Plaintext
237 lines
7.1 KiB
Plaintext
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
|
|
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
|
|
|
|
|
|
'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
|
|
|
|
' 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: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
|
|
|
|
'copy salary markup
|
|
Sheets("Project Information").Select
|
|
Range("D12:M12").Select
|
|
Selection.Copy
|
|
Sheets(projectname).Select
|
|
Range("T21").Select
|
|
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
|
|
:=False, Transpose:=True
|
|
Application.CutCopyMode = False
|
|
|
|
|
|
'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
|
|
|
|
'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
|
|
'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
|
|
'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
|
|
|
|
'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
|
|
|
|
'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
|
|
|
|
'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
|
|
|
|
' 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
|
|
Sheets(projectname).Select
|
|
Application.Goto Reference:=Range("a1"), Scroll:=True
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Sub hide_sheets()
|
|
' Hide staff and salary details
|
|
Sheets("StaffDetails").Visible = xlVeryHidden
|
|
Sheets("Salary Information").Visible = xlVeryHidden
|
|
Sheets("RPU Budget_Template").Visible = xlVeryHidden
|
|
Sheets("debug").Visible = xlVeryHidden
|
|
End Sub
|
|
|
|
Sub unhide_sheets()
|
|
' Reveal staff and salary details
|
|
|
|
'Get password from hidden sheet
|
|
Dim pswd As String
|
|
pswd = Sheets("debug").Range("A1").Value
|
|
|
|
pswdMatch = InputBox("Enter password to unhide sheets")
|
|
|
|
If pswdMatch = pswd Then
|
|
Sheets("StaffDetails").Visible = True
|
|
Sheets("Salary Information").Visible = True
|
|
Sheets("RPU Budget_Template").Visible = True
|
|
Sheets("debug").Visible = True
|
|
Sheets("Project Information").Select
|
|
Else
|
|
Exit Sub
|
|
End If
|
|
|
|
End Sub
|