Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Transfer to userform
Hi,
On a User From I have a text box where the user enters a date. Two queries that I have not yet been able to sort out / find an answer - I would be grateful if someone could assist me. 1. On a user form text box - Is it possible to restrict the user to a particular date format? i.e. 27/05/05 2. On a userform, Once a user enters the date of their order/activity, how do I have that date transferred to 4 text boxes to display in 4 textnoxes the day of week, month, year and date. i.e. user enters 15/05/05 and the text boxes are populated automatically with Monday - 15 - May - 2005 Any help would be fantastic, Thanks, Mickey |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Transfer to userform
1. Use Masked Edit (right click Toolbox, additional controls)
Set the mask property to ##/##/## 2. add a button that, when clicked, reads the date entered & populates the other boxes... Private Sub CommandButton1_Click() On Error GoTo FAIL TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd") TextBox2 = Format(CDate(MaskEdBox1.Text), "dd") TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM") TextBox4 = Format(CDate(MaskEdBox1.Text), "yy") Exit Sub FAIL: MsgBox "Please check the date entered is valid", vbCritical, "Error" End Sub I do however, recommend you use yyyy (4 digit year) Regards - Steve. "MBlake" wrote in message ... Hi, On a User From I have a text box where the user enters a date. Two queries that I have not yet been able to sort out / find an answer - I would be grateful if someone could assist me. 1. On a user form text box - Is it possible to restrict the user to a particular date format? i.e. 27/05/05 2. On a userform, Once a user enters the date of their order/activity, how do I have that date transferred to 4 text boxes to display in 4 textnoxes the day of week, month, year and date. i.e. user enters 15/05/05 and the text boxes are populated automatically with Monday - 15 - May - 2005 Any help would be fantastic, Thanks, Mickey |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Transfer to userform
I don't believe the masked edit control is part of Excel.
-- Vasant "Stevie_mac" wrote in message ... 1. Use Masked Edit (right click Toolbox, additional controls) Set the mask property to ##/##/## 2. add a button that, when clicked, reads the date entered & populates the other boxes... Private Sub CommandButton1_Click() On Error GoTo FAIL TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd") TextBox2 = Format(CDate(MaskEdBox1.Text), "dd") TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM") TextBox4 = Format(CDate(MaskEdBox1.Text), "yy") Exit Sub FAIL: MsgBox "Please check the date entered is valid", vbCritical, "Error" End Sub I do however, recommend you use yyyy (4 digit year) Regards - Steve. "MBlake" wrote in message ... Hi, On a User From I have a text box where the user enters a date. Two queries that I have not yet been able to sort out / find an answer - I would be grateful if someone could assist me. 1. On a user form text box - Is it possible to restrict the user to a particular date format? i.e. 27/05/05 2. On a userform, Once a user enters the date of their order/activity, how do I have that date transferred to 4 text boxes to display in 4 textnoxes the day of week, month, year and date. i.e. user enters 15/05/05 and the text boxes are populated automatically with Monday - 15 - May - 2005 Any help would be fantastic, Thanks, Mickey |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Transfer to userform
I forgets? maybe it is available anyway?
I'm so used to using DEV PCs I forget what is available! If the masked control is not available, then use a text box. I like it better that way since you can type in what ever date format you like e.g. 13-1-05 or 13-Jan-2005 or 13/01/05. The error handling in the sub is very broad & should catch silly entries! (aside note: I hate date formats! to some, 1/6/04 was very cold & to others, it was 1-Jun-2004) "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... I don't believe the masked edit control is part of Excel. -- Vasant "Stevie_mac" wrote in message ... 1. Use Masked Edit (right click Toolbox, additional controls) Set the mask property to ##/##/## 2. add a button that, when clicked, reads the date entered & populates the other boxes... Private Sub CommandButton1_Click() On Error GoTo FAIL TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd") TextBox2 = Format(CDate(MaskEdBox1.Text), "dd") TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM") TextBox4 = Format(CDate(MaskEdBox1.Text), "yy") Exit Sub FAIL: MsgBox "Please check the date entered is valid", vbCritical, "Error" End Sub I do however, recommend you use yyyy (4 digit year) Regards - Steve. "MBlake" wrote in message ... Hi, On a User From I have a text box where the user enters a date. Two queries that I have not yet been able to sort out / find an answer - I would be grateful if someone could assist me. 1. On a user form text box - Is it possible to restrict the user to a particular date format? i.e. 27/05/05 2. On a userform, Once a user enters the date of their order/activity, how do I have that date transferred to 4 text boxes to display in 4 textnoxes the day of week, month, year and date. i.e. user enters 15/05/05 and the text boxes are populated automatically with Monday - 15 - May - 2005 Any help would be fantastic, Thanks, Mickey |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Transfer to userform
"Stevie_mac" wrote in message
... 1-Jun-2004 Agreed about date formats. The above format is the one I always try to use, and encourage others to use. There is no ambiguity. -- Vasant |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Transfer to userform
Thanks for the replies, I am using the format suggested,
Cheers, Mickey |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transfer info to new sheet by date | Excel Worksheet Functions | |||
transfer date to number | Excel Worksheet Functions | |||
Transfer data relevent to date | Excel Discussion (Misc queries) | |||
Transfer data relevent to date | Excel Worksheet Functions | |||
Transfer names and date of birth | Excel Discussion (Misc queries) |