Sum minutes to Combobox

Ramses28

New Member
Joined
May 18, 2018
Messages
10
I want to sum 10 minutes to a combobox (the combobox is filled with an hour in format "hh:mm").

I used the code:

ComboBox2.value = (Format(ComboBox2.Value, "hh:mm")) + (Format("00:10", "hh:mm"))

but it doesn't sum the 10 minutes and i don't understand why?

Thanks in advance
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try this

Code:
Private Sub CommandButton1_Click()
ComboBox2.Value = TimeValue(ComboBox2.Value) + TimeValue("00:10")
End Sub
 
Upvote 0
Thats it!!
The combobox changes to the format to "10:10:00 AM". Is it possible to convert to just "10:10"??
Thanks Yongle
 
Upvote 0
Try this

Code:
Private Sub CommandButton1_Click()
    With ComboBox2
        .Value = TimeValue(.Value) + TimeValue("00:10")
        .Value = Format(.Value, "hh:mm")
    End With
End Sub
 
Upvote 0
Method tested here
- it works (both userform and on-sheet embedded active-x)

Where is your combobox?
 
Last edited:
Upvote 0
Figured out the issue.
The combobox style was wrong. it was defined as dropdownlist. i changed it to combo and the code works perfectly.
Thanks a lot!
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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