Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format from VB to excel

Status
Not open for further replies.

Crashtestdummy

Materials
Joined
May 8, 2002
Messages
10
Location
AU
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???
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top