RasGhul
Well-known Member
- Joined
- Jul 15, 2016
- Messages
- 797
- Office Version
- 365
- Platform
- Windows
Hi Team,
I've been using the following code faithfully on many sheets, but now I'm getting a runtime error on the cdate function as I want the "me.tbdate" textbox to format as a proper date dd/mm/yyyy. for some reason without cdate a standard textbox outputs dates as mmddyy by default.
How can I make the date function work more consistently please?
I've been using the following code faithfully on many sheets, but now I'm getting a runtime error on the cdate function as I want the "me.tbdate" textbox to format as a proper date dd/mm/yyyy. for some reason without cdate a standard textbox outputs dates as mmddyy by default.
How can I make the date function work more consistently please?
Code:
Dim ssheet As Worksheet
Set ssheet = ThisWorkbook.Sheets("Sheet2")
nr = ssheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
'add line entry
ssheet.Cells(nr, 1) = CDate(Me.tbDate)
ssheet.Cells(nr, 2) = Me.ComboBox1.Value
ssheet.Cells(nr, 3) = Me.TextBox1.Value
ssheet.Cells(nr, 4) = Me.TextBox2.Value
Last edited: