View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bigfoot17 Bigfoot17 is offline
external usenet poster
 
Posts: 67
Default AutoFilter Confusion (no records found)

I am having soem problems figuring out how to tackle a problem. I have been
successful in [1] autofiltering a spreadsheet; [2] selecting the filtered
data and [3] copying it to a new sheet where I further manipulate it.

However, I have found that when my autofilter finds no appropriate data (no
record between two dates) instead of getting zero records I instead get all
of the data copied.

Can someone shed light on this and point me in the proper direction? Here
is part of my selection and copy process:
dLrow = Cells(Rows.Count, "P").End(xlUp).Row
'Field:=16 is Column P(card expiration date), D(last name, C(first name)
Selection.AutoFilter Field:=16, Criteria1:="=" & startFilter,
Operator:=xlAnd _
, Criteria2:="<" & endFilter
Range("D3:D" & dLrow & ",E3:E" & dLrow & ",P3:P" & dLrow).Select
Selection.Copy
Workbooks.Add
Range("A2").Select
ActiveSheet.Paste