Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you in advance for your help.
I have a UserForm with the following code: ActiveCell.Offset(0, 1).Select Selection.NumberFormat = "MM/DD/YYYY" ActiveCell = UserForm1.TextBox2 The user is entering a date into Textbox2. I want to make it so that they can only enter the date in MM/DD/YYYY format. The above code doesn't realy work. So far I have tried the following: 1. I went into Control Panel - Regional Options and set the short date format as MM/DD/YYYY. This updates the dates when I type them directly into Excel but not when I enter dates in the UserForm and then have the UserForm place the dates on the worksheet. 2. I also tried the following code from another Newsgroup: Private Sub TextBox2_KeyPress(ByVal KeyAscii As _ MSForms.ReturnInteger) Dim cDelim As Long cDelim = Len(TextBox2.Text) - Len(Replace (TextBox2.Text, "/", "")) Select Case KeyAscii Case Asc("0") To Asc("9"): 'OK Case Asc("/"): If cDelim = 2 Then KeyAscii = 0 Else cDelim = cDelim + 1 End If Case Else: KeyAscii = 0 End Select End Sub This hasn't solved my problem either. Maybe I'm not placing this code in the correct part of the Userform? I am using Windows 2000 Professional and Excel 2000. Thanks again for your help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
change date format from dd/mm/yyyy to mm/yyyy | Excel Discussion (Misc queries) | |||
Help with date format mm/dd/yyyy vs. dd/mm/yyyy | Excel Discussion (Misc queries) | |||
want formula bar date to be dd/mm/yyyy instead of mm/dd/yyyy.How? | Excel Discussion (Misc queries) | |||
convert date mm/dd/yyyy to dd/mm/yyyy | Excel Worksheet Functions | |||
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel | New Users to Excel |