Userform save result as zero if a minus is in the calculation

  • 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.



  • Re: Userform save result as zero if a minus is in the calculation


    Ok, here it is. If you click on a row number a userform pops up. If the total days worked is red then a calculation can be done and this is saved back to the sheet.
    If you click on a row which has the total days green, or under 182, then a msgbox saying no overtime due is shown.


    However, when you click ok, the userform still allows to calculate an amount even though the resulting amount is a negative number .


    I would like to set it so that if the total days worked is a negative number in tbdays when the userform is shown, then the payment due box will have zero in it and hence it will allow me to save a zero back to the sheet for any employee who is 'green'.





    forum.ozgrid.com/index.php?attachment/69820/

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!