Hi all,
I have a userform which is use to add data to a worksheet. Textbox1 is for the date which I would like to be dd/mm/yyyy. I have a Command button to show todays date:
Private Sub CommandButton2_Click()
TextBox1 = Date
End Sub
The date appears in Textbox1 as mm/dd/yyyy......but the output to the worksheet is dd/mm/yyyy
If I manually enter the date in Textbox1 in my preferred format (dd/mmm/yyyy) the output to the worksheet is mm/dd/yyyy
Is there a way of having Textbox1 AND the output in dd/mm/yyyy format
This is the code I use to populate the worksheet:
Private Sub CommandButton1_Click()
activesheet.Select
Dim LastRow As Object
Set LastRow = activesheet.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Value
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.Text
LastRow.Offset(1, 3).Value = TextBox4.Text
LastRow.Offset(1, 4).Value = ComboBox2.Value
LastRow.Offset(1, 5).Value = ComboBox1.Text
MsgBox " Transaction added"
response = MsgBox(" Do you want to add another transaction?", _
vbYesNo)
If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox2.Text = ""
ComboBox1.Text = ""
TextBox1.SetFocus
Else
Unload Me
End If
End Sub
Thanks in advance....
Bookmarks