UserForms - Time Format oddity

KG Old Wolf

Board Regular
Joined
Sep 20, 2009
Messages
65
I am using a textbox to capture user input for clock time "start and stop". All is fine EXCEPT for when a person enters 12:00... then I get a displayed format of 12:05 AM

Enter 11:59 and you get 11:59 AM; 12:01 and you get 12:01 PM.... but it goes crazy when I enter 12:00

Oh, btw - the data is stored and presented correctly once the userform is completed... I can then go merrily on my way to do whatever computation I want... it just shows up wrong on the userform and only if 12:00 is entered, every other time displays correctly....

neither of these work:
Start_Time = Format(Start_Time.Value, "hh:mm AM/PM")
Stop_Time = Format(Stop_Time.Value, "h:mm AM/PM;@")

Any and all suggestions most appreciated....

Ken
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

GTO

MrExcel MVP
Joined
Dec 9, 2008
Messages
6,154
Sorry no help, with '12:00' typed in, I got '12:00 PM' on both.

Rich (BB code):
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1 = Format(Me.TextBox1.Value, "hh:mm AM/PM")
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox2 = Format(Me.TextBox2.Value, "h:mm AM/PM;@")
End Sub
 

Forum statistics

Threads
1,136,341
Messages
5,675,206
Members
419,553
Latest member
hanahass

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
Top