Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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
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
Excel, how do I write a macro to convert the date value to text? airedale girl Excel Programming 1 September 19th 06 04:06 PM
Trying to write vba code to import another spreadsheet... joep3 Excel Discussion (Misc queries) 3 September 6th 06 06:50 PM
How to write a "Text" or date custom format FBB Excel Worksheet Functions 1 November 28th 04 01:10 AM
Read/Write data to/from text files from a spreadsheet. lothario[_37_] Excel Programming 8 November 2nd 03 03:10 PM
Date problem from code to text box to spreadsheet Joe 90[_2_] Excel Programming 2 October 20th 03 11:18 PM


All times are GMT +1. The time now is 04:30 PM.

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

About Us

"It's about Microsoft Excel"