Copy with criteria
I could definately be proved wrong here, but with an auto
filter row 1 is always left there regardelss of what is in
it. So you should test row 1 independently of the
autofilter
Jase
-----Original Message-----
I am using an old code that I have from a project several
years old and am trying to make it work for something
else. In column E you have set values (11 of them) one of
which is "AMA". With this formula everything works. It
takes that column and looks for the value "AMA" and then
takes that data and copies it onto a new page. The only
problem is that if there is no value of "AMA" in the
column then it copies the first row, whatever it is. I
can't have it do that, and I have no idea how to fix this,
or why is is doing that to begin with. Any help would be
greatly appreciated.
Here is the code:
Sub CompactedToSeperatedData()
With Sheets("Compacted")
.Columns("E:E").AutoFilter Field:=1, Criteria1:="AMA"
.Columns("A:G").SpecialCells(xlCellTypeVisible).Co py
Sheets("SeperatedData").Range("A3")
.Columns("G:G").AutoFilter
End With
End Sub
.
|