![]() |
Force TextBox to hold time ("hh:mm")
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 |
Force TextBox to hold time ("hh:mm")
If you have your textbox linked to a cell (control source), then remove the
link. -- Regards, Tom Ogilvy "Titus" wrote in message ups.com... 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 |
All times are GMT +1. The time now is 02:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com