I have a userform which is used to calculate overtime payments.
When clicking on a row in the sheet the userform pops up with the rate and days overtime already populated from the sheet.
If an employee has worked under days then a minus amount of days shows in the userform in tbdays. However it still calculates the amount and this is then saved back to the sheet. I would like to save as zero payment for any employee with minus days.
Private Sub TextBox1_Change() End Sub Private Sub Rank_Change() End Sub Private Sub CommandButton1_Click() Me.Payment.Value = Me.tbrate.Value * Me.tbdays.Value End Sub Private Sub CommandButton2_Click() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets("daysworked") x = Me.Lblrow ws.Cells(x, 17) = UserForm2.Payment UserForm2.Hide End Sub Private Sub CommandButton3_Click() Me.Hide End Sub Private Sub Label4_Click() End Sub Private Sub Payment_Change() Payment.Value = Format(Payment.Value, "€#,##0.00") 'to show payment amount in euro End Sub Private Sub tbdays_Change() If tbdays < 1 Then MsgBox ("ERROR. No overtime due to this rank. They need to do more work") 'if the employee has worked less then 183 days then they will not be due any overtime payment End If End Sub Private Sub tbrank_Change() End Sub Private Sub tbrate_Change() tbrate.Value = Format(tbrate.Value, "€#,##0.00") 'daily overtime rate in euros End Sub Private Sub UserForm_Click() End Sub