+ Reply to Thread
Results 1 to 6 of 6

Increase decrease time with a spin button

  1. #1
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Increase decrease time with a spin button

    Hi all,

    I am trying to create code to increase and decrease the time using a spin button. I am unsure how to do this. I have the following code to increase and decrease date but i am unsure how to do it for the time. Any help is much appreciated?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Increase decrease time with a spin button

    Similar to what you did for Reg17.Text, only use "Now" instead of "Date". Once you have the time in there you can add and subtract from it just like you did for your date.

    Here's a generic example:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Re: Increase decrease time with a spin button

    Hi there,

    I tried this but i got a match type error 13:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Increase decrease time with a spin button

    I don't know what spInviteAtt.SmallChange is, but you wouldn't put it inside Now. Now is literally a string of text.

    When you used CDate, you were casting spInviteAtt.SmallChange as a Date/Time variable, regardless of what variable type it actually is. The same casting works for time. So this code should work:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Re: Increase decrease time with a spin button

    Unfortunately i still cannot get the code to work. I think it has something to do with i am dealing with time and there are 60 seconds in a minute. spInviteDate.small change basically refers to the spinbutton small change value, which is set at 1. I think in this case 1 will not = 1 minute because in time you need to divide by 60 or something.

  6. #6
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Re: Increase decrease time with a spin button

    Managed to get this code to work to increase the clock by 15 mins and decrease by 15mins:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Increase or Decrease times in time stamp, stored in the cells
    By igor7 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2014, 07:22 AM
  2. [SOLVED] Help with Spin Button. Set Spin button starting value based on a text box value
    By etuckram in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-18-2014, 10:05 AM
  3. Replies: 3
    Last Post: 09-18-2012, 01:01 AM
  4. Percentage of increase/decrease for time
    By buzzkill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 10:43 AM
  5. Increase/decrease indent button
    By JPCPA in forum Excel General
    Replies: 3
    Last Post: 10-31-2006, 06:22 PM

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