Userform TextBox changes date from dd-mmm-yyy to mm/dd/yyyy despite Format(TextBox4.Text, "dd/mm/yyyy")

KyleJackMorrison

Board Regular
Joined
Dec 3, 2013
Messages
107
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello,

So I have TextBoxes 11-43 which returns dates from columns AJ - BP. The dates in the cells are formatted dd-mmm-yyyy.

When the Userform Initialises it runs this code:

VBA Code:
With Me
.TextBox11.Value = Cells(ActiveCell.Row, "AJ").Value
etc....
End with

However it as soon as the date gets to 29/02/2020 the next date displays 03/01/2020, 03/02/2020.......03/12/2020.

I have a this code to change the date however it still doesn't work.

VBA Code:
For n = 11 To 43
Me.Controls("TextBox" & n).Text = Format(Me.Controls("TextBox" & n).Text, "dd/mm/yyyy")
Next n

Any ideas?

TIA
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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