Extract Data


Posted by Roy Brunt on August 21, 2001 10:08 AM

Start Code Product Bx No
17/08/2001 12:10 AES101 BEC28 1043
18/08/2001 12:23 AES101 BEC28 1044
18/08/2001 12:34 SP27 CAB 1003
18/08/2001 12:35 NI4 CDG 1018
19/08/2001 13:02 AES86 ALEC25 1020
19/08/2001 10:13 AES101 BEC28 1045
20/08/2001 13:10 AES101 BEC28 1046

From the above which are on Sheet 2 I want a macro to be able to input 2 dates and anything that falls within these 2 dates is copied to Sheet 3.

Any help greatly appreciated. This is wrecking my head.

Roy

Posted by Mark W. on August 21, 2001 10:14 AM

I'd recommend that your macro employ Advanced
AutoFilter-ing to accomplish this task. Just
establish a criteria range containing your
2 dates, and all it'll take is one line of code
to do the trick.

Posted by Roy on August 21, 2001 10:27 AM

Can you help me with this. Not sure how to do what you are suggesting




Posted by Mark W. on August 21, 2001 11:35 AM

Using cells F1:G2 as a Criteria range containing...

{"Start Code","Start Code";">=8/17/01","<=8/19/01"}

and with your data in cells A1:D8, you can use
the following statement...

Range("A1:D8").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"F1:G2"), CopyToRange:=Range("Sheet3!A1"), Unique:=False

...to extract records with 'Start Codes' between
8/17/01 and 8/19/01 inclusive.