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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,216,231
Messages
6,129,631
Members
449,522
Latest member
natalia188

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