Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Code for date ranges

  Asked By: Caleb    Date: Jan 27    Category: MS Office    Views: 813
  

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.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Addison Campbell     Answered On: Jan 27

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: