Spin Button

S

Steve

Hello
My users have to enter a Start date/time and End date/time. I have
added a calendar drop down to my worksheet for the date but now I
would like to add a separate spin button control fro the times. I
have added the control with min/max of 0-23 (time entered in mil
time) How do I format for it to displat as time 13:00 rather than
number 13.0. When I format as time HH:MM and click the button it
increments by 1 day rather than one hour.
Thanks!
 
S

Steve

OK I got it to work with this code...

Private Sub SpinButton1_SpinDown()
Cells(12, 7).Value = Cells(12, 7).Value - 1 / 24
SpinButton1.Value = 0
End Sub

Private Sub SpinButton1_SpinUp()
Cells(12, 7).Value = Cells(12, 7).Value + 1 / 24
SpinButton1.Value = 0
End Sub


I guess this should have been in programming rather than functions.

Follow up Question...

The time is normally entered as whole hours but sometimes may be
entered intra hour ( 13:30). User can over type the 13:00 and enter
13:30 but now when the button is clicked it increments to 14:30. How
can I get it to go back to the hour on next click?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top