PDA

View Full Version : Sleeper: Filter Problems



Dowsey1977
08-05-2005, 05:38 AM
Hi,

I use the below code to filter a spreadsheet I have and copy to another sheet. I have just added some more rows (using a form - as I did for all rows of data), but the filter doesn't seem to want to pick up the new rows. I can filter on Size, type, name, manager and view all. Up until now these have all worked. I have added 3 new lines and size, type and manager bring back no rows if filter is asking for one of the 3 new rows, name works fine and view all just removes the 3 new lines. Any ideas why this might be??


Option Explicit

Sub Advanced_Filter()
Application.ScreenUpdating = False
Range("A1:K1").Select
Range(Selection, Selection.End(xlDown)).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"Criteria"), CopyToRange:=Range("Output!A11:K11"), Unique:=False
Sheets("Output").Select
Range("A12").Select
Sheets("DataSheet").Visible = False
If IsEmpty(Range("A12")) Then
MsgBox ("No Results Found Based On Your Search Criteria - Please Refine and Try Again!")
End If
Application.ScreenUpdating = True
End Sub


Many thanks in advance

malik641
08-05-2005, 07:02 PM
I get an error here:


Range(Selection, Selection.End(xlDown)).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"Criteria"), CopyToRange:=Range("Output!A11:K11"), Unique:=False
At the _Global range "Criteria". What are you using for the "Criteria" range??

Dowsey1977
08-08-2005, 12:43 AM
My criteria range is P3:Q4, and the P3:Q3 range has the exact titles of the source data and the P4:Q4 has the exact same terms as the source data too.

Zack Barresse
08-08-2005, 07:46 AM
Can you zip/upload a sample file?