Force TextBox to hold time ("hh:mm")

T

Titus

Still Need Help!

Can anyone help?

I'm having a great deal of difficulty trying to have my TextBox display
time ("hh:mm") on a UserForm that I created. The TextBox will take the
time correctly, but when the UserForm re-opens it displays the time as
numbers not in the time format. It will only display the time once I
click in and them out of the TextBox. This will be too confusing for
my users!

My VBA code is attached to both the TextBox and the UserForm, on the
TimeTextBox1 I am using the following code:

Private Sub TimeTextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TimeTextBox1.Value = Format(TimeTextBox1.Value, "hh:mm")
End Sub

I am using a separate macro that runs the UserForm which actatives the
UserForm that has the following code:

Private Sub UserForm_Activate()
UserForm1.TimeTextBox1.Value =
Format(FrmNotifUpdate.TimeTextBox1.Value, "hh:mm")
End Sub

Thanks for your help!
RES
 
T

Tom Ogilvy

If you have your textbox linked to a cell (control source), then remove the
link.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top