Attempting to write VBA code to perform two separate Advance Filtering procedures using differing data ranges & criteria ranges. Advance Filter procedure #1 CopyToRange = worksheet2 cell A1:E1. The amount of data copied with this procedure will comprise 1 to 15 rows. I would like Advance Filter procedure #2 to copy data from Worksheet1 to Worksheet2 using a dynamic "CopyToRange". I would like the dynamic "CopyToRange" to identify the last row of data in Worksheet1 columns A:E then select the 2nd blank row below the existing data copied via Advanced Filter procedure 1. I have attempted to use but do not know how to insert the VBA code into the Advance Filter code.
Following is the code I have tried to use which does not work. Errors out during 2nd Advance Filter procedure.
Application.ScreenUpdating = False
Dim imaxrows As Range ' Range("A" & imaxrows + 2)
Sheets ("worksheet2").select
imaxrows = Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Worksheet1").Select
Sheets("Worksheet1").Range("A6:E21").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Sheets("Worksheet1").Range("A3:E4"), CopyToRange:=Range("A1:E1"), Unique:=True
Sheets("Worksheet1").Range("A32:E201").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Sheets("Worksheet1").Range("A29:E30"), CopyToRange:=range(imaxrows + 2), Unique:=True
Application.ScreenUpdating = True
Bookmarks