Right, sorry about that.
napalm
Autowreckers TimeSheet
Sub AutoWreckers()
'
' AutoWreckers Macro
' Macro to create Employee Time Sheet
'
' Keyboard Shortcut: Ctrl+x
'
' This code selects A2:C2, merges cells, centres text , colours background & includes title
Range("A2").FormulaR1C1 = "Down Town Auto Wreckers"
Range("A3").FormulaR1C1 = "Employee's Time Sheet"
' Centre the headings
Range("A2:C2").Select
Selection.HorizontalAlignment = xlCenter
Selection.Merge
Range("A3:C3").Select
Selection.HorizontalAlignment = xlCenter
Selection.Merge
' Shaded headings
Range("A2:C3").Interior.ColorIndex = 15
' Enter rate of pay
Range("A5").FormulaR1C1 = "Rate Of Pay"
Range("B5").FormulaR1C1 = "$10.50 "
' Enter Sub headings
Range("A7").FormulaR1C1 = "Employee name"
Range("B7").FormulaR1C1 = "Hours worker"
Range("C7").FormulaR1C1 = "Pay"
' Widen Columns
Columns("A:C").ColumnWidth = 15
' Right Alignment Pay Heading
Range("C7").HorizontalAlignment = xlRight
' Place line
Range("A7:C7").Borders(xlEdgeBottom).Weight = xlMedium
' Enter the formula for C8
Range("C8").FormulaR1C1 = "=R5C2*RC[-1]"
Range("C8").NumberFormat = "$#,##0.00"
End Sub
Code for Input Form
Private Sub UserForm_Activate()
'Initialise controls of the form
txtEmployeeName.Text = ""
txtHours.Text = spnHours.Value
End Sub
Private Sub spnHours_Change()
'Reflect the value of spinner in text box
txtHours.Text = spnHours.Value
End Sub
Private Sub CmdCancel_Click()
'Hide form
frmEmployeeDetails.Hide
End Sub
Private Sub cmdOK_Click()
'Tranfer Data to the worksheet
Sheets("Sheet1").Range("A8").Value = txtEmployeeName.Text
Sheets("Sheet1").Range("B8").Value = txtHours.Value
'Close The Form
frmEmployeeDetails.Hide
'Initialise form
txtEmployeeName.Text = ""
txtHours.Text = spnHours.Value
End Sub
Bookmarks