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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Just test the textbox first:
Code:
If IsDate(Textbox.text) then activecell.value = CDate(textbox.text)
for example.
 
Upvote 0

Forum statistics

Threads
1,215,415
Messages
6,124,768
Members
449,187
Latest member
hermansoa

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