Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Code for date ranges

  Asked By: Maya    Date: Nov 14    Category: MS Office    Views: 719
  

Hope someone can help. I am looking for code that
will look at 2 different cells, each populated with a date, and then
give me a list of all database rows that contain info greater than or
equal to the first date, and less than or equal to the second date.

Any assistance would be most greatly appreciated.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Adelaide Fischer     Answered On: Nov 14

This may help  you get going.



Dim Date1 As String

Dim Date2 As String



Date1 = ">=" & Range("C1").Value

Date2 = "<=" & Range("D1").Value



Range("A:A").Select 'Assuming column A stores your dates



Selection.AutoFilter Field:=1, Criteria1:=Date1, Operator:=xlAnd _

, Criteria2:=Date2

 
Didn't find what you were looking for? Find more on Code for date ranges Or get search suggestion and latest updates.




Tagged: