Date changes on worksheet

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Morning,

Headers are in row 4
Row 5 is hidden
Column M is for date.
My database range is A-W then down the page.
A new row is created in row 6 & i then start to complete each cell,some i type but some have drop down list.

Im finding that when i enter the date the month & day reverse when i leave the cell.
So this morning i have typed in cell M6 02/06/2020 i leave the cell to see it change to 06/02/2020
As a test i unhide row 5 and type the same date in cell M5 but when i leave the cell it stays the same.

Checking the format for cell M5 is shown in screenshot below.

I cant afford to have dates change like its doing so can you advise a fix or another approach for the date.

Thanks
 

Attachments

  • 6909.jpg
    6909.jpg
    104.7 KB · Views: 5
See attached.

6912 M5 6913 M6
 

Attachments

  • 6912.jpg
    6912.jpg
    77.9 KB · Views: 1
  • 6913.jpg
    6913.jpg
    69.9 KB · Views: 1
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Now that is definitely eliminated, a change being made by vba is the only other cause that I can think of.

@mole999 can you think of any other possible causes?
 
Upvote 0
I agree but having looked at the code for this sheet i dont see anything.
I will look about a bit buyt thanks for looking
 
Upvote 0
If you post your worksheet change code then we can have a look at it for you.
 
Upvote 0
OK
See the 2 attacheed codes.

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim myStartCol As String
    Dim myEndCol As String
    Dim myStartRow As Long
    Dim myLastRow As Long
    Dim myRange As Range

    If Target.Cells.Count > 1 Then Exit Sub
    
    Application.ScreenUpdating = False
    
'   *** Specify columns to apply this to ***
    myStartCol = "A"
    myEndCol = "W"

'   *** Specify start row ***
    myStartRow = 5
    
'   Use first column to find the last row
    myLastRow = Cells(Rows.Count, myStartCol).End(xlUp).Row
    
'   Build range to apply this to
    Set myRange = Range(Cells(myStartRow, myStartCol), Cells(myLastRow, myEndCol))
    
'   Clear the color of all the cells in range
    myRange.Interior.ColorIndex = 6
    
'   Check to see if cell selected is outside of range
    If Intersect(Target, myRange) Is Nothing Then Exit Sub
    
'   Highlight the row and column that contain the active cell
    Range(Cells(Target.Row, myStartCol), Cells(Target.Row, myEndCol)).Interior.ColorIndex = 8
    Target.Interior.Color = vbGreen
    Application.ScreenUpdating = True

End Sub

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rng As Range
    Dim cell As Range
    
    Set rng = Intersect(Target, Range("A6:W" & Rows.Count))
    
'   Exit if nothing entered into out target range
    If rng Is Nothing Then Exit Sub
    
'   Loop through all cells in our target range
    Application.EnableEvents = False
    For Each cell In rng
        cell = UCase(cell)
    Next cell
    Application.EnableEvents = True
    
        If Not Intersect(Target, Range("L6:L" & Range("L" & Rows.Count).Row)) Is Nothing And Target.Cells.Count = 1 Then
    
        Application.EnableEvents = False
        
        With Target
            .Interior.ColorIndex = 6
            .Font.Size = 11
            .BorderAround xlContinuous, xlThin
            .Font.Name = "Calibri"
            .Font.Bold = True
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlVAlignCenter
            
        End With
      
        Application.EnableEvents = True
        
    End If
  End Sub
 
Upvote 0
I agree with you that there is nothing in there which would do it. Maybe @mole999 will think of something else, failing that, can you upload the workbook for us to look at?
 
Upvote 0
I can supply workbook but i dont want all to see it as so much info & dont want to erase out names etc.
I can supply you and mole a copy though ?
 
Upvote 0
Wait to see what mole says first, forum rules say that all correspondence related to questions has to be in the public area of the forum.
As a moderator, mole will be able to clarify if it is acceptable to supply a copy off forum as long as the discussion remains here.
 
Upvote 0
OK
Thanks for that.
I do understand but ive a few sheets in the same workbook & also plenty of private info that i dont want to delete etc.

I understand about making a copy but i would realy want to leave it as it is.
 
Upvote 0
we would recommend a cut down data book, hosted on a free public site, so we wouldn't have to register to get a copy
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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