Date is driving me nuts

built4thekill

New Member
Joined
Oct 26, 2020
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Hi All. I'm having an issue which is driving me crazy!! I'm sure the solution is easy but I cant find it. Basically I have a cell in which I'm supposed to type in a date then a corresponding cell will give me a DoB. Now whenever I type in the date in UK format it keeps changing it to US! I've tried changing the format to Date - English UK and also Custom - dd/mm/yyyy but it still changes it to US each time. E.g. 03/04/1980 (3rd April) would auto change to 04/03/1980 (4th March). Any help would be really appreciated!!
 
Your change event will change all cells to capitals - is that intentional? (It's also the cause of your current problem)
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Your change event will change all cells to capitals - is that intentional? (It's also the cause of your current problem)
No I actually only need it to apply to columns A to Z. I think you might be right! How can I change to code so it applies only to columns A to Z? the date cell is in column AB so hopefully wont be affected.

Current code:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.HasFormula Then Exit Sub
        Application.EnableEvents = False
        Target = UCase(Target.Cells(1))
    Application.EnableEvents = True
End Sub
 
Upvote 0
I'd change it to something like this:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Intersect(target, range("A:Z")) is nothing then exit sub
    On Error Resume Next
    Application.EnableEvents = False
    Dim cell As Range
    For Each cell In Target.Cells
        If Not cell.HasFormula And Not IsNumeric(cell.Value2) Then cell.Value = UCase(cell.Value)
    Next cell
    Application.EnableEvents = True
End Sub
 
Upvote 0
Solution
Can you post any code that you have on the sheet (right click the sheet tab and click view code).
Can you also format the cell as a number and post the number it returns please.
Sorry @MARK858 i just noticed you asked this. 03/04/1980 comes up as 29314 in number format
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,887
Members
449,057
Latest member
Moo4247

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