×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Date format from VB to excel

Date format from VB to excel

Date format from VB to excel

(OP)
I have a data entry from in VB which automatically adds the date to the entry on the excel workbook.  When the auto date is shown on the form, it is in the format I want it.  It shows it in the same format as it grabs my system date (dd/mm/yy).  When I put the entry on my worksheet, it puts it in mm/dd/yy, even if i specify for the destination field to have the dd/mm/yy format.  for example, the 10th of May 2002 will show on my form as 10/05/02.  It will show as 05/10/02 on my excel worksheet, even if I set it to dd/mm/yy.

Any suggestions???

RE: Date format from VB to excel

Crashtestdummy:

If you wanted to insert the formated date into cell A1, you would ues the following code:

Range("A1").Value = Date
Range("A1").NumberFormat = "mmmm d, yyyy"

This will give you "May 10, 2002"

You can play with the formating to get the format you want.  It is often useful to record a macro when faced with problems like this.

Good Luck!

jproj

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources