To do a Filter In Place, use the constant XLFilterlnPlace as the Action parameter in the AdvancedFilter command and remove the CopyToRange from the command:

IRange.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=CRange, ^Unique:=False

Then the programmatic equivalent to loop through Visible Cells Only is this code:

For Each cell In Range("A2:A" & FinalRow).SpecialCells(xlCellTypeVisible)

MsgBox Ctr & " cells match the criteria"

0 0

Post a comment