Why is Excel changing the date I enter to American style?

Ingrid_SM

New Member
Joined
Jul 21, 2021
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I have a workbook with a field to enter a date in format dd-mmm-yyyy.
If the day is lower than 13, it takes the day as the month and the month as the day and gives me the date in the same format dd-mmm-yyyy but with the date that would result in American style.
For example, I want to enter 11 (day) / 05 (month = May) / 2021. When I do enter, I get 05 (day) - November - 2021.
If I enter the date when the day is higher than 12, it does it correctly. For example: I enter 13 (day) / 05 (month = May) / 2021. It gives me 13-may-2021.
In cell format, I have: Regional configuration = Spain.

View attachment 43217

In Control Panel / Region, I have Format = Spanish too...

View attachment 43218

What's wrong?

Thanks in advance!
 
Yes, I can do that. Thanks!
You are welcome.

Usually, I like to understand why certain things are happening, but every so often, one comes along that I cannot just figure out.
At that point, it is more important to me to get it working right, even if I cannot understand why it is behaving the way it is.
If was created by someone else long ago on a different system, who knows what other factors could be affecting it (I think we identified most of the most likely causes).
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You are welcome.

Usually, I like to understand why certain things are happening, but every so often, one comes along that I cannot just figure out.
At that point, it is more important to me to get it working right, even if I cannot understand why it is behaving the way it is.
If was created by someone else long ago on a different system, who knows what other factors could be affecting it (I think we identified most of the most likely causes).
I totally agree. I also need to know why things happen that way, but sometimes I have to quit, specially if I'm involving other people that do the work for me! ;)
Thanks to everybody again <3
 
Upvote 0
Hello Ingrid,

In the project window (in the left pane) double click on Hoja3 (aka ENTRADA DADES S-503).
In the code window on the right replace the code with any of the options given by Rory.

Just changing the UCase to Value2 will fix it but it does make sense to use Rory's code and totally skip the UCase code if it is a number.
 

Attachments

  • 1627027606471.png
    1627027606471.png
    131.5 KB · Views: 7
Upvote 0
Solution
Hello Ingrid,

In the project window (in the left pane) double click on Hoja3 (aka ENTRADA DADES S-503).
In the code window on the right replace the code with any of the options given by Rory.

Just changing the UCase to Value2 will fix it but it does make sense to use Rory's code and totally skip the UCase code if it is a number.
It works!!!! :giggle:

OMG! I've been changing the code all the time on the Modules part, not on the Sheets part...! I guess that's why your fixings didn't work... I'm sorry I didn't know that.

1627053296433.png


I'm amazed at your knowledge and very thankful for all your time and help.

Thanks and have a great weekend!

Ingrid
 
Upvote 0
Thank you for being prepared see it through to a resolution.
It would have left us wondering if we didn't get it fixed for you.

Worksheet events only trigger if they are in a "sheet" module or in the ThisWorkbook module, that trying to uppercase a date could cause that to happen was new to us too.

Glad we could help and have a great weekend (it is already Saturday here in Australia)
 
Upvote 0
Thank you for being prepared see it through to a resolution.
It would have left us wondering if we didn't get it fixed for you.

Worksheet events only trigger if they are in a "sheet" module or in the ThisWorkbook module, that trying to uppercase a date could cause that to happen was new to us too.

Glad we could help and have a great weekend (it is already Saturday here in Australia)
Thanks for your teachings!
Have a great week!
❤️
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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