How to fix Userform dd/mm/yyyy change to mm/dd/yyyy

George06

New Member
Joined
Dec 10, 2023
Messages
2
Office Version
  1. 365
Hey guys, have seen a few people asking the same questions but just cant seem to work it out, on my userform i enter the date as dd-mm-yyyy but when i click submit the format is automatically changed to mm-dd-yyyy on my excel sheet. For example if i enter 1/8/2023 it will change to 8/1/2023.

Thanks in advance for any help.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hey guys, have seen a few people asking the same questions but just cant seem to work it out, on my userform i enter the date as dd-mm-yyyy but when i click submit the format is automatically changed to mm-dd-yyyy on my excel sheet. For example if i enter 1/8/2023 it will change to 8/1/2023.

Thanks in advance for any help.
Here is my code, Need txtDateR and txtDateS to both come through as dd-mm-yyyy. Thanks

[/CODE]
Option Explicit


Private Sub cmdReset_Click()

Dim msgValue As VbMsgBoxResult

msgValue = MsgBox("Do you wish to reset the form?", vbYesNo + vbInformation, "Confirmation")

If msgValue = vbNo Then Exit Sub

Call Reset

End Sub

Private Sub cmdSave_Click()

Dim msgValue As VbMsgBoxResult

msgValue = MsgBox("Do you wish to save data?", vbYesNo + vbInformation, "Confirmation")

If msgValue = vbNo Then Exit Sub

Call Submit
Call Reset

End Sub

Private Sub Image1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub

Private Sub txtDateR_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
txtDateR.Value = Format(txtDateR.Value, "dd-mm-yyyy")
End Sub



Private Sub txtDateS_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
txtDateS.Value = Format(txtDateS.Value, "dd-mm-yyyy")
End Sub


Private Sub txtLabRef_Change()

End Sub

Private Sub UserForm_Initialize()


Me.cmbJob1.RowSource = "tablePriceList[Test]"
Me.cmbJob2.RowSource = "tablePriceList[Test]"
Me.cmbJob3.RowSource = "tablePriceList[Test]"
Me.cmbJob4.RowSource = "tablePriceList[Test]"
Me.cmbJob5.RowSource = "tablePriceList[Test]"
Me.cmbJob6.RowSource = "tablePriceList[Test]"
Me.cmbJob7.RowSource = "tablePriceList[Test]"
Me.cmbJob8.RowSource = "tablePriceList[Test]"

Me.cmbLocate.RowSource = "tableLocate[Location]"


Call Reset

End Sub
[/CODE]
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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