Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I write a VB code for a 'Date' text box for spreadsheet
I am having difficulties in creating a VB code for a 'Parts Inventory'
spreadsheet. In my 'Userform' in Visual Basic I have a text box used for entering a date as a number eg. 290906 which will then enter in the 'Parts Inventory' spreadsheet as 29/09/06. Does anyone know what the code is or how to do it? I was told it had something to do with YEAR: function??? Or maybe the format cells for the 'Date' column?? Another question... What is the code for VB so when information is already entered in the spreadsheet it will notify me with a dialog box? Any help will be greatly appreciated as I'm stumped. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I write a VB code for a 'Date' text box for spreadsheet
Say input number 290906 is stored in x, then try
Range("A1").Value = DateValue(Left(x, 2) & "/" & Mid(x, 3, 2) & "/" & Right(x, 2)) Adjust destination cell reference! As for the other question! Give more details! Another question... What is the code for VB so when information is already entered in the spreadsheet it will notify me with a dialog box? Regards, Stefi |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I write a VB code for a 'Date' text box for spreadsheet
Another solution that tolerates differences in international settings:
Range("B1").Value = DateValue(Left(x, 2) & Application.International(xlDateSeparator) & Mid(x, 3, 2) & Application.International(xlDateSeparator) & Right(x, 2)) Regards, Stefi €žStefi€ť ezt Ă*rta: Say input number 290906 is stored in x, then try Range("A1").Value = DateValue(Left(x, 2) & "/" & Mid(x, 3, 2) & "/" & Right(x, 2)) Adjust destination cell reference! As for the other question! Give more details! Another question... What is the code for VB so when information is already entered in the spreadsheet it will notify me with a dialog box? Regards, Stefi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel, how do I write a macro to convert the date value to text? | Excel Programming | |||
Trying to write vba code to import another spreadsheet... | Excel Discussion (Misc queries) | |||
How to write a "Text" or date custom format | Excel Worksheet Functions | |||
Read/Write data to/from text files from a spreadsheet. | Excel Programming | |||
Date problem from code to text box to spreadsheet | Excel Programming |