+ Reply to Thread
Results 1 to 14 of 14

spin control for date and time

  1. #1
    Registered User
    Join Date
    10-19-2011
    Location
    Billings, MT
    MS-Off Ver
    Excel 2003
    Posts
    74

    spin control for date and time

    Hi, How can I make a spin control box, the one with the up and down arrows, work on a cell that is formatted with date and time. When I tried, it was changing the dates and not changing it well. I need it to change the minutes by a factor of 5 minutes for each click of the arrows.. Can this be done?
    Thanks for your help
    Ted
    Last edited by thmehr; 08-08-2012 at 06:48 AM.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: spin control for date and time

    What code are you currently using? You can use code similar to this (assuming the time is in cell A2)

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-19-2011
    Location
    Billings, MT
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: spin control for date and time

    Thanks BigBas. That worked when I deleted the Private on line one and when I deleted all format controls.
    Your the best.
    Ted

    PS; How do a I show this solved?

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: spin control for date and time

    I believe you click EDIT POST on your first post, then select Go Advanced. From there, I believe you can modify your title to solved.

    And I'm glad I could be of assistance

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: spin control for date and time

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    HTH
    Regards, Jeff

  6. #6
    Registered User
    Join Date
    10-19-2011
    Location
    Billings, MT
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: spin control for date and time

    HI. Thanks for everyone's help, but I found an issue. When I click the down arrow on the spin box, time moves forward and not backwards. Does anyone have a fix for this? Thanks again. Ted

  7. #7
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: spin control for date and time

    You just have to enter the code into the appropriate event for the spinbutton. See the following code:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-19-2011
    Location
    Billings, MT
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: spin control for date and time

    HI BIGBAS, I tried to enter your code. My VBA editor is making this into two seperate macros. When I paste your code, a line is inserted between the two routines. One is called SpinDown1 and the other is called SpinUp1. How can I assign two macros to one spin button? Thanks for your help again. Ted

  9. #9
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: spin control for date and time

    It should be treated as two separate macros because they are two different events. Nonetheless, they refer to the same spinbutton.

    Give it a try in a sample file. It should work. If not, let me know what kind of error you have and we can work around it

  10. #10
    Registered User
    Join Date
    10-19-2011
    Location
    Billings, MT
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: spin control for date and time

    I am confused. I have been creating a new module in VBA Editor and pasteing your code. It creates two macros. One is called Spin up and the other is called Spin down. When I assign the macro to the spin button, it either goes up or down, depending on the which macor I assign, but not both ways. I so stupid when it comes to VBA. Thanks Ted

  11. #11
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: spin control for date and time

    Maybe we should take a step back. Is this a Forms spinbutton or Control spinbutton? If you're not sure, right click on the spinbutton. Is there an option named View Code? If not, you are using a Forms spinbutton. Delete that, then go to View (in the main menu bar) -> TOOLBARS -> Control Toolbox. From there, select the spin button and add in where you'd like. Next, right click on the button, choose view code, and paste the code that I gave you into the module.

    The final step is to go to back to the control toolbox, then click on the blue triangle (if you hover over it, it's called Design Mode). Once you do all that, the spinbutton SHOULD work. If not, can you post the workbook and I can add it for you

  12. #12
    Registered User
    Join Date
    10-19-2011
    Location
    Billings, MT
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: spin control for date and time

    OK, That is working for me now. One more stupid question. How do I format the spin button? I need to adjust the size. When I right-click on it, it controls the input. Thanks for your help. I very much appreciate it.

    ---------- Post added at 12:25 PM ---------- Previous post was at 12:21 PM ----------

    I got it. Thanks again. Ted

  13. #13
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: spin control for date and time

    When working with a CONTROL spinbutton (or any object), you have to enter into Design mode (remember that Blue triangle). The blue triangle design mode button is a toggle button that turns design mode on and off. When design mode is on, you can format the item. If design mode is off, then the spinbutton is in use.

  14. #14
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: spin control for date and time

    @ thmehr

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1