spinButton problem

  • Can anyone shed some light on what I might be doing wrong. I have a user form with several fields and I'm trying to use spin buttons where possible to alleviate too much validation. With the code posted below the Date SpinButton works fine but I can't get either of the Time ones to work.

  • Re: spinButton problem

    Time in Excel is the decimal portion of 1 day. Midday is 0.5, 6:00pm is 0.75 etc. So you cannot simply add the spinbutton value, you need to divide it by the number of seconds in a day. (86400) If you want the spinbutton to increment seconds, minutes in a day if incrementing in minutes, same for hours.

    You also have another problem in that the time constantly changes so you cannot use the current time in your calculations. You need to determine a fixed time, for example when the userform is loaded, and base the calculations on that.

  • Re: spinButton problem

    Problem solved.
    Found the following code on MrExcel

Participate now!

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