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.
229 lines
7.0 KiB
Plaintext
229 lines
7.0 KiB
Plaintext
6 years ago
|
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
|