Help with Date checking code

M

Mr. Clean

How would I change
this condidtion to check for a value
where:

PLEXP is >= Date and
the Month of PLEXP is <= Next Month

Also taking into consideration a Dec/Jan
value combination. (PLEXP Month is Dec)

If ((DateValue(PLEXP) >= Date) And _
(DatePart("M", DateValue(PLEXP)) <= _
(DatePart("M", Date) + DatePart("M", Date) + 1))) Then

I can't quite get it right. Not used to VBA.
 
T

Tom Ogilvy

If ((DateValue(PLEXP) >= Date) And _
(DateValue(PLEXP) <= _
DateSerial(year(Date),Month(Date)+2,0)) Then

I think you would run into problems at for the Dec Jan time frame if you
just check on Month, so This checks if the PLEXP is <= the last day of the
next month. I believe that will achieve your ends.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top