Question concerning dates

dualhcsniatpac

Board Regular
Joined
Feb 18, 2009
Messages
126
Im thinking it is, but is it possible to check a date that has been inputted to be valid. Example: Users will enter a date that is previous to the current days. I would like it so if they try and return Feb. 30 that it spits it back. I guess i could go through and do a bunch of if statements but i would rather not.

My date inputs are 2 separate integers: coverdate1 and coverdate2 for month and day respectively.

Thanks in advance

David
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You could put data validation on your cells, and allow onlow dates that are equal to or higher then today

Data validation-Allow-Date and make it greater than =TODAY() and anything less than todays date won't be allowed ion the cell. Not quite sure how that would pan out tomorrow though, it would stop you from putting in yesterdays date but tomorrow would it delete a date you entered today?
 
Upvote 0
Sorry I forgot to mention im using VBA. Maybe your on the right track. Thats kinda what I was thinking about. Im not sure how to manipulate dates.

I have the code to make sure a future date has not been entered. Its just checking if it is valid or not.

Code:
ActiveCell.Offset(0, 3).NumberFormat = "@"
ActiveCell.Offset(0, 3).Value = Format(coverdate1.Value, "00") & "/" & Format(coverdate2.Value, "00")

I hope that helps
 
Upvote 0

Forum statistics

Threads
1,218,499
Messages
6,142,829
Members
450,449
Latest member
Dave Carr QM

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