Computing.Net > Forums > Office Software > Date format for Excel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Date format for Excel

Reply to Message Icon

Name: starsmile67
Date: October 22, 2009 at 10:31:37 Pacific
OS: Windows Vista
Subcategory: Microsoft Office
Comment:

I hope someone can help me here.
I am creating a spreadsheet that will be opened and used in mulitple countries. I have formatted the date cells for mm/dd/yy and set to US format. When this same spreadsheet is opened in Australia, the date is input the same format but switches to dd/mm/yy when exiting the cell.
Is there a way to lock the US format so that it does not change in other countries?
Thanks for any help you can provide!



Sponsored Link
Ads by Google

Response Number 1
Name: Humar
Date: October 22, 2009 at 11:13:27 Pacific
Reply:

Hi,

This is not a solution, just a workaround:

If you format the date with mmm (Oct) rather than mm (10), it will be clear to users in all countries which is the month and which is the day.

BTW is this
a single spreadsheet on a server accessed from different countries or
is it a spreadsheet that is e-mailed back and forth, or
is it several copies of an original that are sent out and returned, or
something else!

I ask this because it could affect the solution.

Regards


0

Response Number 2
Name: starsmile67
Date: October 22, 2009 at 11:28:48 Pacific
Reply:

Thanks for the info! I will see if this will help.

The spreadsheet will be downloadable from a server to be opened and used in multiple countries.


0

Response Number 3
Name: Mike (by mmcconaghy)
Date: October 22, 2009 at 11:37:49 Pacific
Reply:

Just a comment:

You understand that how a date is formatted is only cosmetic
Excel stores the date as a number,
IE todays date is 10/22/2009 or if you prefer 22/10/2009 but Excel stores it as: 40108 which is the number of Days since Jan 1, 1900.

MIKE

http://www.skeptic.com/


0

Response Number 4
Name: Humar
Date: October 22, 2009 at 11:54:34 Pacific
Reply:

Hi,

As Mike says, dates are only cosmetic.

You could include code in the 'Before Close' event which reformats all dates in your desired format, but that might result in errors as users in Australia etc. assume that dates are in the logical day-month-year order, rather than the US standard month-day-year.

You could add two buttons with some code.
One button formats all dates per US standard and the other button formats all dates per day-month-year format.

This sample code shows that it would not be too complicated to do, then wherever the spreadsheet is opened the user can see dates in their preferred format:

Sub NADateFormat()
Dim rngCell As Range
For Each rngCell In Worksheets("Sheet1").UsedRange
    If IsDate(rngCell.Value) Then
        rngCell.NumberFormat = "mm-dd-yy"
    End If
Next
End Sub

The sheet name will need to be changed to match yours.
Also the code would need to be altered if more than one sheet in the workbook has dates in it.

Regards


0

Response Number 5
Name: starsmile67
Date: October 22, 2009 at 11:59:10 Pacific
Reply:

Thank you both for your input!

This is a great forum site! :-)


0

Related Posts

See More



Response Number 6
Name: DerbyDad03
Date: October 22, 2009 at 12:32:17 Pacific
Reply:

You might be able to automate Humar's suggestion by checking the Country Code for each machine upon opening the spreadsheet.

See here for more info, including this sample code:

Sub Code()
   Country_Code = Application.International(xlCountryCode)
   If Country_Code = 1 Then
      MsgBox ("Hello")
   ElseIf Country_Code = 34 Then
      MsgBox ("Hola")
   End If
End Sub

The site offers a list of Country Codes returned by

Application.International(xlCountryCode)

which you could then use in a list of Select Case or If options to format the dates using Humar's NumberFormat sugestion.

Check out the VBA Help files for the International Property to see if there is anything else in there you can use.


0

Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Date format for Excel

Date formatting in Excel www.computing.net/answers/office/date-formatting-in-excel/9134.html

Date format in Excel www.computing.net/answers/office/date-format-in-excel/4728.html

Date format in Excel www.computing.net/answers/office/date-format-in-excel/7976.html