Userform date formats (US to UK)

thousand

New member
Joined
Apr 2, 2017
Messages
30
Reaction score
0
Points
0
Excel Version(s)
2010
Hi, I currently have these codes which adds data from userform into a worksheet. The dates appear in US form, is there a way to format this? Have tried cdate but doesn't work.

Thanks

Code:
Sub ToggleButton1_Click()
'Find the last Row with data in a Column
    Dim NextRw As Long
    With ActiveSheet
        NextRw = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
        
    End With
    
'Add data from userform
Cells(NextRw, 1) = ComboBox1.Text
Cells(NextRw, 2) = ComboBox2.Text
Cells(NextRw, 3) = TextBox1.Text
Cells(NextRw, 4) = TextBox2.Text
Cells(NextRw, 5) = TextBox3.Text
Cells(NextRw, 6) = TextBox4.Text
Cells(NextRw, 7) = TextBox5.Text
Cells(NextRw, 8) = ComboBox3.Text
Unload Me
End Sub
 
Last edited by a moderator:
Hi,
try these.
Assume date textbox is TextBox1.
Code goes in the Private Sub UserForm_Initialize() event.
Code:
TextBox1.Value = Format(TextBox1.Value, "dd/mm/yyyy")
or
Code:
TextBox1.Value = Format(Date, "dd/mm/yyyy")
or in the Sub ToggleButton1_Click() event.
Code:
Cells(NextRw, 3) = CDate(TextBox1.[COLOR=#ff0000]Value[/COLOR])
 
Back
Top