Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using todays date and the current time in Excel user forms

Status
Not open for further replies.

Epsilon101

Programmer
Mar 30, 2004
384
GB
Hi i was trying to find what i am after through the faqs, posts and google but nothing i have found explains what i am after.

I have 2 text boxes on a user form, i want to show in 1 todays date always in the format dd/mm/yyyy or dd/mmm/yyyy or whatever is best when you have computers with different language settings and you want the date to be inputted correctly, and the other textbox to display the time of the day in 24 hour.

So if i was doing it in worksheet cells im after the same thing as the functions:

=TODAY() for the date
=NOW() - TODAY() for the time

i am trying to put this in under userform_initialize, ive tried some variations and nothing has worked as yet, could someone shed some light on the correct way to do this, plz.. Thanks for any help

---------------------------------------

Neil
 
Hi i have just tried this..

Code:
TxtDate.Value = FormatDateTime(Now(), vbShortDate)
TxtTime.Value = FormatDateTime(Now(), vbLongTime)

Is this a good idea or should i be doing it a different way

---------------------------------------

Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top