Userform Date entry issues

RasGhul

Well-known Member
Joined
Jul 15, 2016
Messages
797
Office Version
  1. 365
Platform
  1. 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?

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:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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