LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting a date from a textbox


Hello. I'm trying to format the date entry in a textbox on a form s
that when a future date is entered via the form onto the relevant cel
in the active sheet, it will always show in the following format
'01/mm/yyyy' in the cell. The first day of the month should always b
01 and there should be slashes showing. So no matter how the use
enters the date in the textbox (whether they use the '/' or not, and/o
put the day other than 01) it will always override with the correc
format into the cell. The textbox is always initialized to sho
'01/mm/yyyy' which the user will type over. I have tried a couple o
ways but can't get it to work properly:

This is the line of code I'm working from, where textbox3 is the plac
the date is entered:

If OptionButton5 Then Cells(Nextrow, 3) = TextBox3.Text

I have tried using:
TextBox3.Text = format(textBox3.Text, "01/mm/yyyy")
which just literally adds 01/mm/yyyy into the box after the textbo
text

and I've tried:

With TextBox3
Select Case Len(.Text)
Case 2, 5
.Text = .Text & "/"
End Select

If InStr(.Text, "//") Then
.Text = Replace(.Text, "//", "/")
End If
End With

which doesn't do anything. I have also considered using the calende
but this isn't suitable on this occasion. I would appreciate help wit
this, thanks

--
Blondegir
-----------------------------------------------------------------------
Blondegirl's Profile: http://www.excelforum.com/member.php...fo&userid=2961
View this thread: http://www.excelforum.com/showthread.php?threadid=54367

 
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
Textbox date formatting capt Excel Discussion (Misc queries) 14 January 2nd 08 10:02 AM
textbox formatting jnf40 Excel Discussion (Misc queries) 1 August 3rd 06 08:12 PM
Compare date in cell to date in Textbox asmenut Excel Programming 2 February 3rd 06 02:49 PM
Textbox Date formatting problem Capp Excel Programming 1 January 11th 06 06:16 PM
converting date from a textbox to a date format neowok[_17_] Excel Programming 5 February 23rd 04 01:40 PM


All times are GMT +1. The time now is 06:37 AM.

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"