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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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