Date criteria does not appear to be working

Godders199

Active Member
Joined
Mar 2, 2017
Messages
313
Office Version
  1. 2013
Hello, i am slowly working through some old code, and while the following does not error, it does not appear to be doing anything.If is part of the criteria needed to copy rows to another worksheet. effectlively it should only be looking for rows equal or less than 20 days from today.

StartDate = DateSerial(Year(Date), Month(Date), Day(Date) - 20)

If Sheets("checkSmart").Range(QSubmissionDate & R).Value >= StartDate Then

As i said the code runs with no error, just does not seem to take this into consideration. I have put >= in""

clearly this element is wrong but can seem to find the magic solution .
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You can simplify the first line to just:

Code:
StartDate = Date - 20

Your criterion is then anything after 20 days ago.
 
Upvote 0
thanks , had just worked out the solution, have changed to

dateRng =Sheets("instructions").Range("p24")
Or Sheets("checkSmart").Range(QSubmissionDate& R) <= dateRng
and it excludes dates befoe p24
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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