Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I'm looking for a code to transform a number value in a userform to a date value after enter is pressed. For example, in the UF, the user would enter 010100, which would change to the date format 01-Jan-2000 after enter (or tab) is pressed or another cell selected. Any ideas? Thanks in advance, Peter -- Peter1999 ------------------------------------------------------------------------ Peter1999's Profile: http://www.excelforum.com/member.php...o&userid=33997 View this thread: http://www.excelforum.com/showthread...hreadid=549886 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
as long as you can legislate that they type it correctly (!)
use the exit event of the textbox (for this example called TxtDate) txtDate.text=Format(DateSerial(Right(TxtDate, 2), Mid(txtDate, 3, 2), Left(txtDate, 2)), "dd-mmm-yyyy") (note I'm in the UK so have taken your date as DDMMYY - change the date serial around as necessary) Peter1999 wrote: Hi, I'm looking for a code to transform a number value in a userform to a date value after enter is pressed. For example, in the UF, the user would enter 010100, which would change to the date format 01-Jan-2000 after enter (or tab) is pressed or another cell selected. Any ideas? Thanks in advance, Peter -- Peter1999 ------------------------------------------------------------------------ Peter1999's Profile: http://www.excelforum.com/member.php...o&userid=33997 View this thread: http://www.excelforum.com/showthread...hreadid=549886 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for replying! However, no matter what I do, VB returns the message that it's a mismatch... I'm just a newbie at VB so any additional help would be appreciated ;-) Thanks again, Peter -- Peter1999 ------------------------------------------------------------------------ Peter1999's Profile: http://www.excelforum.com/member.php...o&userid=33997 View this thread: http://www.excelforum.com/showthread...hreadid=549886 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As I tested it first, I know it works - but maybe you haven't swapped
the date around as I suggested - 010100 is not a good example as I don't know if the first 01 is January or the day! IF you need help with the debugging, you can email me at (remove all _pink_meat_ from the email address for it to work!) Peter1999 wrote: Thanks for replying! However, no matter what I do, VB returns the message that it's a mismatch... I'm just a newbie at VB so any additional help would be appreciated ;-) Thanks again, Peter -- Peter1999 ------------------------------------------------------------------------ Peter1999's Profile: http://www.excelforum.com/member.php...o&userid=33997 View this thread: http://www.excelforum.com/showthread...hreadid=549886 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date format in userform | Excel Programming | |||
Date format from UserForm | Excel Programming | |||
Restrict date format for UserForm | Excel Discussion (Misc queries) | |||
Qn: Date Format in TextBox in UserForm? | Excel Programming | |||
Userform date format problem | Excel Programming |