user form initialising with US date not UK

grapevine

Board Regular
Joined
May 23, 2007
Messages
208
I have the following code which is bring up todays date, but is shows 11/03/2017 for today instead of 03/11/2017. My code so far is shown below but i still cannot get it to display in UK format. Can anyone tell me where i am going wrong
Many thanks
Code:
Private Sub UserForm_Initialize()
'default values for user form
With txtDate
        .Text = "dd/mm/yyyy"
        .SetFocus
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
Me.txtDate = Date
txtDate.Value = Format(CDate(txtDate), "dd/mm/yyyy")
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello,

I didn't want to start a new thread so I'm hoping someone can help me with this similar issue.

I'm using the below code to set a "To" and "From" date range in a UserForm. The dates in that range are in "dd/mm/yyyy" format, but the textbox keeps on displaying them in "mm/dd/yyyy" format for some reason.

Is there a way to fix this?

Thanks.

Code:
Private Sub UserForm_Activate()

    txtFrom.Value = Sheets("RestCalc").Range("W1").Value
    txtTo.Value = Sheets("RestCalc").Range("Y1").Value
    
End Sub
 
Upvote 0
Have you actually tried what was shown in post#2?
 
Upvote 0
Glad it's sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,615
Messages
6,120,538
Members
448,970
Latest member
kennimack

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