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 |
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 |
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 |
All times are GMT +1. The time now is 04:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com