Date changes dd/mm/yy to mm/dd/yy

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have a column formatted to short date.
Today when i enter 01/08/2017 into the first cell it keeps changing to 08/01/2017
If i format the cell to text its fine.

Any reason you know of for this to happen ??
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Y not enter dates in dd/mm/yyyy and select range of dates and run code below?

Does it help?

Code:
Public Sub DateConverter()
    Dim rngCells  As Range
    Dim rngCell   As Range
    Dim strMsg    As String
    Dim intDay    As Integer
    Dim intMonth  As Integer
    Dim intYear   As Integer
    Dim DateValue As Date

    On Error Resume Next
    strMsg = "Select the cells to convert:" & _
                  vbCr & vbCr & "Reverses Month and Day date evaluation," _
                  & vbCr & "i.e. DD-MM becomes MM-DD if possible."
    'Receive the input.
    Set rngCells = Application.InputBox(strMsg, "Date Converter", , , , , , 8)
    'Test for no input received.
    If Not IsObject(rngCells) Or rngCells Is Nothing Then
       GoTo Exit_DateConverter
    End If
    
    'Date Conversion Loop.
    For Each rngCell In rngCells
        If IsDate(rngCell) Then
            intDay = Day(rngCell)
            intMonth = Month(rngCell)
            intYear = Year(rngCell)
            DateValue = intMonth & "/" & intDay & "/" & intYear
            rngCell.Value = DateValue
        End If
    Next rngCell
    
    'Format Date
    rngCells.NumberFormat = "mm/dd/yy"
Exit_DateConverter:
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top