PDA

View Full Version : code for excel advanced filtering?


ken
December 11th 03, 10:55 PM
How do i write the code in the CopyToRange: section of the
advanced filter so that the range can be changed each time
this section of code gets repeated in a loop? In the
below example, how do I change the ("P1") so that it
offsets to the right 9 cells each time this code is read
in the loop, or can you make it some type of variable that
I can name just prior to executing this part of the code?
(I also need for this code to be not sheet specific-- this
section of the loop code will be initiated on different
sheets.)


Range("A1:H626").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Sheets _
("Sheet3").Range("A1:H5"), CopyToRange:=Range
("P1"), Unique:=False

Thanks.

Google