• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Update 3 Text Boxs with the Time stamp in Userform

Hi,

I have 3 Text boxes in a Userform that will transfer the data to an Excel sheet. This is what I require.

1- In TextBoxNow I will require that when I click on the textbox, displays automatically the time in the format hh:mm AM/PM

2 - In TextboxStartTime and TextboxEndTime I will require that when I click on the textboxes, let me choose the time I will require.

Thanks
 
Here's an updated version. I had some time so put some checks in to verify that the date format entered manually for start & end time is in HH:MM AM/PM.
 

Attachments

You just have to apply chirayu's code to following events and adjust target to each TextBox.

StartTimeTextBox_Enter() and EndTimeTextBox_Enter() events.

See attached.
 

Attachments

Hi Chihiro,

Thx for the help, But I need to fix something?

1 - For the Current Time Text Box:
- How can I delete the seconds?
- Where in the document is the code for this Text Box

2 - For the Start time Text Box and End Time Text Box
- How can I just show the time in this format?
Ex: (1:45 PM) right now I have to put a 0 in front of the 1. the 0 is not required

thank you
 
1 - = Format(Time, "hh:mm AM/PM")
- In UserForm_Initialize()

2 - Add below code in front of Else.
Code:
ElseIf _
Mid(MyInput, 4, 2) <= 59 And _
Mid(MyInput, 4, 2) >= 0 And _
Left(MyInput, 1) >= 1 And _
Left(MyInput, 1) <= 9 Then
    StartTimeTextBox.Value = MyInput 'Change to EndTime as needed.
 

Attachments

Back
Top