advancedfilter blowing up with runtime error 1004
Hi;
I have a workbook with two sheets: Data and Results. My search button on the results sheet when pressed will see what criteria has been entered in the criteria section of Results and then display matches in Data 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 CritRng = "B3:I5" ' range of cells for Criteria table ResultsRng = "B8:I8" ' 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:=False When it tries to execute, I get the following error: Run-time error '1004': The extract range has a missing or illegal field name. Is this extract range in the Results sheet (criteria or results section?) or the Data sheet? Any help is appreciated. -- JJFJR |
All times are GMT +1. The time now is 11:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com