Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Advancedfilter returning all rows instead of ones that match crit
Hi;
I have a workbook with two sheets: Data and Results. My search button on the Results sheet will see what criteria has been entered in the criteria section of Results and then display rows in the Data sheet that match the Criteria. The matching rows are displayed in the Result section of the Result sheet. I have the following declarations: Dim MaxResults As Integer, MyCol As Integer, ResultsRng As String Dim MyRow As Integer, LastDataRow As Integer, DataRng As String Dim CritRow As Integer, CritRng As String, RightCol As Integer Dim TopRow As Integer, BottomRow As Integer, LeftCol As Integer DataRng = "$A$2:$H$9" 'range of cells to searched on the data sheet CritRng = "$B$3:$I$3" ' range of cells for Criteria table ResultsRng = "$B$9:$I$1000" ' range of headers for Results table Towards the end of the code is the following line: Worksheets("Data").Range(DataRng).AdvancedFilter Action:=xlFilterCopy, _ CriteriaRange:=Range(CritRng), CopyToRange:=Range(ResultsRng), _ Unique:=True Instead of returning only the rows in the "Data" sheet that match the criteria range, all rows in "Data" are returned to the Results section of the Results sheet. DataRng ,CritRng and ResultsRng all seem to have the proper values. This occurs whether I set Unique in the AdvancedFilter statement to true or false. Any help is greatly appreciated. -- JJFJR |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Match returning #N/A | Excel Worksheet Functions | |||
index match array function-returning only first match, need last. | Excel Worksheet Functions | |||
Count the number of rows where more than one column meets set crit | Excel Worksheet Functions | |||
How to use AdvancedFilter wildcard to match end of string? | Excel Discussion (Misc queries) | |||
How to count rows in a user-defined AutoFilter or AdvancedFilter is active? | Excel Programming |