ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Event validating two ranges with dates (https://www.excelbanter.com/excel-programming/273976-event-validating-two-ranges-dates.html)

G R E G

Event validating two ranges with dates
 
Hi,

I would like to validate two ranges with dates using
Worksheet_Change event.

The date in the first column should be always greater than
a corresponding entry on the same row of the next column.

Data Validation is not an option since both columns will
be pasted from another source.

Is it possible to do with Intersect (rng1, rng2) or I need
to loop thru ?

Also, I wonder how I could count the “wrong” dates in the
second column and have a message saying for example
something like “Column B has 20 cells with incorrect
dates?”

Thanks much,
Greg


Tom Ogilvy

Event validating two ranges with dates
 
=SUMPRODUCT((A1:A500<=B1:B500)*(B1:B500<"")*(A1:A 500<""))

will give you the count of bad dates in B.

--
Regards,
Tom Ogilvy

G R E G <Greg@*.* wrote in message
...
Hi,

I would like to validate two ranges with dates using
Worksheet_Change event.

The date in the first column should be always greater than
a corresponding entry on the same row of the next column.

Data Validation is not an option since both columns will
be pasted from another source.

Is it possible to do with Intersect (rng1, rng2) or I need
to loop thru ?

Also, I wonder how I could count the “wrong” dates in the
second column and have a message saying for example
something like “Column B has 20 cells with incorrect
dates?”

Thanks much,
Greg





All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com