Please help. Going insane.
I have a simple sheet with four columns (Date, Details, Reference & Value). I have a textbox on a user form to record a date, but when I submit that value to a cell it is converting it to US format.
I have a BeforeUpdate event on the textbox that coverts that value entered to date. This seems to work fine.
Private Sub tbDateInfo_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
' Me.tbDateInfo = CDate(Me.tbDateInfo)
Me.tbDateInfo = DateValue(Me.tbDateInfo)
End Sub
However, when running to code below, that date is swapped from UK to US format. My regional settings are correct, and the cell format is dd/mm/yyyy.
Private Sub SubmitEntry_Click()
Dim NextEmptyRow As Long
Sheets("Cash").Activate
NextEmptyRow = Application.WorksheetFunction. _
CountA(Range("A:A")) + 1
Cells(NextEmptyRow, 1) = tbDateInfo.Value
Cells(NextEmptyRow, 1).Select
Selection.NumberFormat = "dd/MM/yyyy;@"
Cells(NextEmptyRow, 2) = DetailsInfo.Value
Cells(NextEmptyRow, 3) = RefInfoCombi.Value
Cells(NextEmptyRow, 4) = ValueInfo.Value
End Sub
I would imagine this has been asked before but I was unable to find a solution.
Thanks in advance.
Doug
I have a simple sheet with four columns (Date, Details, Reference & Value). I have a textbox on a user form to record a date, but when I submit that value to a cell it is converting it to US format.
I have a BeforeUpdate event on the textbox that coverts that value entered to date. This seems to work fine.
Private Sub tbDateInfo_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
' Me.tbDateInfo = CDate(Me.tbDateInfo)
Me.tbDateInfo = DateValue(Me.tbDateInfo)
End Sub
However, when running to code below, that date is swapped from UK to US format. My regional settings are correct, and the cell format is dd/mm/yyyy.
Private Sub SubmitEntry_Click()
Dim NextEmptyRow As Long
Sheets("Cash").Activate
NextEmptyRow = Application.WorksheetFunction. _
CountA(Range("A:A")) + 1
Cells(NextEmptyRow, 1) = tbDateInfo.Value
Cells(NextEmptyRow, 1).Select
Selection.NumberFormat = "dd/MM/yyyy;@"
Cells(NextEmptyRow, 2) = DetailsInfo.Value
Cells(NextEmptyRow, 3) = RefInfoCombi.Value
Cells(NextEmptyRow, 4) = ValueInfo.Value
End Sub
I would imagine this has been asked before but I was unable to find a solution.
Thanks in advance.
Doug