Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling Data between 2 dates in to a new workbook

Status
Not open for further replies.

JasonEnsor

Programmer
Sep 14, 2010
193
GB
Hi Guys,

What would be the best method do you think of going through a workbook and finding all entries where in Column A the date fell between April 2011 and April 2012 then copying that data in to a new workbook. My first thought is to loop through each sheet and then each row and add check if the date is between the required dates then copy to a temporary worksheet. When I have looped through them all I could then copy the data to a new workbook. It seems quite logical to me to do it that way however how do I test if a date is between the 2 values?

Many thanks in advance for any help you can give

Regards

Jason
 
how do I test if a date is between the 2 values
A starting point:
If IsDate(yourCell) And yourCell >= #2011-04-01# And yourCell <= #2012-03-31# Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi,

You might also consider using ms query in a new workbook to return rows from that sheet that meet the criteria.
Code:
Select *
From [Sheet1$]
Where [DateField] Between #2011/04/01# And #2012/03/31#
Of course using YOUR sheet name and files name.


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top