Add 10 minutes to time in userform

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,069
Hi All,

I would like a vba script that will add 10 minutes to the time that I have in a userform textbox, but also the option to add 9 mins 34 secs etc...

This has been covered in other posts except my time needs to be in a specific format as follows.

I am using a wintimer and the time is displayed as.

Code:
strTime = Split(Format$(Now, "h:mm:ss am/pm"))(0)

I want the time to be displayed this way i.e 1:26:50 (without am/pm on the end).

Thanks
 
Well it's not tomorrow but I found some time to check out your codes.

Thanks very much Rick and Chuck, both codes will do the job nicely, much appreciated.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
After working with these scripts I now have an additional question.

I store a time i.e. 11:02:03 as a value in a textbox, I then want to add the 9 mins 30 secs to the textbox value, can you please advise how to do this so that it is based on a time value and doesn't add 9.30 making the textbox value and invalid time.

An invalid time would be making the texbox value i.e time is 11:59:00 making an incorrect time of 11:68:30 whereas it should be 12:08:30.

Thanks
 
Upvote 0
It does not sound like you are using my code line then. This...

Code:
TextBox2.Value = CDate(TextBox1.Value) + TimeSerial(0, 9, 30)
cannot produce the answer you posted. However, in thinking about it, you might have time values and time increments to add that will take the new time across midnight. Assuming you do not want to pick up the day value that results, change the above code line to this...

Code:
TextBox2.Value = TimeValue(CDate("1:59:00") + TimeSerial(0, 9, 30))
 
Upvote 0
Ignore this message... my system "hiccupped" and I ended posting the same message twice. I simply replaced the duplicated text with this notice.
 
Last edited:
Upvote 0
Thanks Rick,

I just worked it out myself also.

Sorry I used Chuck's initial code as it had the 2 values in different texboxes.

But I do appreciate your help though.
 
Upvote 0
Sorry have struck another problem with the script.

If the time value in textbox1 = 12:08:02
and the time value in textbox2 = 12:18:01

How do I display the time difference in textbox 3 i.e. 9 mins 59 secs

Textbox1 will keep updating until it reaches textbox2 value and then calls a form but I wanted to see a value of remaining time.
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

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