Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Format in Userform


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Date Format in Userform

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Format in Userform


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Date Format in Userform

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date format in userform cutsygurl Excel Programming 3 April 19th 06 09:44 AM
Date format from UserForm SOS[_39_] Excel Programming 3 February 16th 06 02:22 PM
Restrict date format for UserForm Rob Excel Discussion (Misc queries) 2 December 19th 05 12:13 AM
Qn: Date Format in TextBox in UserForm? Michael Vaughan Excel Programming 1 August 23rd 04 10:03 AM
Userform date format problem jennie Excel Programming 2 July 30th 04 01:49 PM


All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"