debug error with CDate function in empty textbox

ohexcell_ineedu

New Member
Joined
Jan 28, 2012
Messages
47
Hey guys,

I am trying to create a form that the user keys in the date in the format dd/mm/yyyy, and it then gets pasted into a cell. Sometimes though there isn't always a need to fill in the textbox with a date, and that produces an error (because there are no values there that are a date).

You can download my sample worksheet from here - https://dl.dropboxusercontent.com/u/9154762/Book1.xlsm

Just open up the user form then don't key in any values to repeat the error.

Any help will be appreciated.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Just test the textbox first:
Code:
If IsDate(Textbox.text) then activecell.value = CDate(textbox.text)
for example.
 
Upvote 0

Forum statistics

Threads
1,203,487
Messages
6,055,713
Members
444,810
Latest member
ExcelMuch

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