Date changes itself on worksheet

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
Office Version
  1. 2007
Platform
  1. Windows
I am once again having issue with dates.

On my userform i have a datepicker which shows the current date

I send the userform values to worksheet BUT the date i see in the cell is 08/05/2024

In another cell on my worksheet it also does the same if i type a date out,example 04/07/2024 changes to 07/04/2024

Along with other issues i have OCD & like this to be in capitals.

The issue with the date toggles when i add / remove this code below.
Without it the date is fine.
Add the code & date changes.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rng As Range
    Dim Cell As Range
    
    Set rng = Intersect(Target, Range("A2:L" & Rows.count))
    
    If Not rng Is Nothing Then
    
        Application.EnableEvents = False
        For Each Cell In rng
            Cell = UCase(Cell)
        Next Cell
        Application.EnableEvents = True
    End If
  
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try changing this line to be the below:
VBA Code:
            Cell.Value2 = UCase(Cell.Value2)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,737
Messages
6,180,657
Members
452,992
Latest member
TokugawaIesuma

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