Input Box Exit Sub If Not Date or When Cancel is Selected.

ajlcpa

New Member
Joined
Nov 18, 2011
Messages
15
Hi Folks:

I can handle this if I Dim the variable as a string, but I really need to Dim it as a Date. I want to exit the sub if a date is not entered or if Cancel is selected.

Thank you for reading and your help.


VBA Code:
 Dim DateEntry As Date
    
   
   DateEntry = InputBox("Please enter the oldest start date using this format MM/DD/YY", "Date Selection")
 
Do you want to take a shot at helping me sort? Or should I start a new threads
If t's a different problem than please start a new thread.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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