Spin Button changing Time.

user21136

Active Member
Joined
Sep 20, 2003
Messages
325
Hi,

I'm trying to change the hour and minutes 00:00 of selected cells using 2 spin buttons (one for hour and one for minute).

Using a Control spin button this is what I have but it just changes the date :)

Code:
Sub SpinButton1_GotFocus()
    ActiveCell.Activate
End Sub

Sub SpinButton1_SpinUp()
    With ActiveCell
        .Value = .Value + 1
    End With
End Sub

Sub SpinButton1_SpinDown()
    With ActiveCell
        .Value = .Value - 1
    End With
End Sub

Any ideas please?

Cheers, Glenn.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
1 = a day

0.5 = 12 hours, think that's the problem

0.0066666666666667 = 1 minute
 
Upvote 0
One other thing...

I noticed the "Forms" buttons look nicer than the Control variety :biggrin:

Is there a way to use the above code with a Forms spin button. I noticed if I add a Forms spin button it's called "Spinner 393".

Thanks.
 
Upvote 0
not sure about forms buttons, i've just recently started using shapes (ANY SHAPE), and making them run a macro, they seem to run so much faster, just don't do a nice visual up / down
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top