US Date Format returned in User Form

Denny57

Board Regular
Joined
Nov 23, 2015
Messages
183
Office Version
  1. 365
Platform
  1. Windows
I have a custom display in my worksheet for showing the date in dddd, dd, mmmm, yyyy format and want to display the same format in a corresonding User Form. The input value is displayed in UK format so today is 10/06/22 in the cells and displays as Friday, 10, June, 2022.

I have the following Module in my user form which should take the value in the ws cell and return the custom format in the textbox.

VBA Code:
Private Sub txtDate_Change()
If IsDate(Me.txtDate.Text) Then
Me.txtDate.Text = Format(Me.txtDate.Text, "dddd, dd, mmmm, yyyy")
End If
End Sub

Which works fine when the DAY value is greater than 12.
28/05/2022 displays as Saturday, 28, May, 2022

When the DAY value is 12 or less, then the date is diplayed in US format
09/06/2022 appears as Thursday, 09, June, 2022 in my worksheet but as Tuesday, 06, Septermber, 2022 in the User Form

Any ideas how I should chnage the format in the textbox so the UK date format is displayed as in my worksheet.
 

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.
How do you populate the cell value into the textbox?
Try using range text property, something like this:
VBA Code:
Textbox1.Text = Range("A1").Text
 
Upvote 0
Solution
How do you populate the cell value into the textbox?
Try using range text property, something like this:
VBA Code:
Textbox1.Text = Range("A1").Text
Thank you,, I should have considered taking .Text instead of .Value
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,085
Members
448,548
Latest member
harryls

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