Hi All
With the below CommandButton1_Click Macro, What I want to do is the following: Incorporate this code to make my If Statement work.
If (Me.Box10.Value > 0 Then
ws.Range("F18") = Me.Box12.Value * 4
ws.Range("F17") = Me.Box13.Value * 4
Else
ws.Range("F18") = Me.Box12.Value
ws.Range("F17") = Me.Box13.Value
End If
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim ws As Worksheet
If CBox.Value = "" Then
MsgBox " PLEASE ENTER A WEEK NO"
Exit Sub
End If
If CBox1.Value = "" Then
MsgBox " PLEASE SELECT A EMPLOYEE"
Exit Sub
End If
If Not Evaluate("ISREF('" & CBox1.Value & "'!A1)") Then
MsgBox " GENERATE PAYSLIP"
Exit Sub
End If
Set ws = Sheets(CBox1.Value)
ws.Activate
ws.Range("E5") = CBox.Value
ws.Range("E6") = Me.Box.Value & " " & Me.Box1.Value & " " & Me.Box2.Value
ws.Range("E7") = Me.Box4.Value
ws.Range("D9") = Me.Box5.Value
ws.Range("B9") = Me.Box6.Value
ws.Range("C9") = Me.Box7.Value
ws.Range("C11") = Me.Box8.Value
ws.Range("B14") = Me.Box9.Value
ws.Range("F11") = Me.Box10.Value
ws.Range("F12") = Me.Box11.Value
ws.Range("F18") = Me.Box12.Value
ws.Range("F17") = Me.Box13.Value
ws.Range("F20") = Me.Box15.Value
ws.Range("F21") = Me.Box16.Value
ws.Range("A14") = Me.Box17.Value
ws.Range("A17") = Me.Box18.Value
ws.Range("A20") = Me.Box19.Value
ws.Range("A23") = Me.Box20.Value
ws.Range("b6") = Me.CBox1.Value & " " & Me.Box3.Value
CBox1.Value = ""
Box3.Value = ""
Box4.Value = ""
Box5.Value = ""
Box6.Value = ""
Box7.Value = ""
Box8.Value = ""
Box9.Value = ""
Box10.Value = ""
Box11.Value = ""
Box12.Value = ""
Box13.Value = ""
Box15.Value = ""
Box16.Value = ""
Box17.Value = ""
Box18.Value = ""
Box19.Value = ""
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Bookmarks