itipu
06-20-2007, 12:37 AM
Hi,
Currently I am filtering for some errors in my sheet using the following code:
Application.ScreenUpdating = False
With Cells
.Columns("A:L").AutoFilter Field:=1, Criteria1:="0"
.Rows("2:" & .Rows.Count).SpecialCells(xlCellTypeVisible).EntireRow.Copy
.Columns("A:L").AutoFilter Field:=1, Criteria1:="<>"
End With
Application.ScreenUpdating = True
So currently I just delete all the rows selected.
I would like to however add a new Sheet called "Errors" and copy the data prior deletion into this new sheet:
.Rows("2:" & .Rows.Count).SpecialCells(xlCellTypeVisible).EntireRow.Copy
.Rows("2:" & .Rows.Count).SpecialCells(xlCellTypeVisible).EntireRow.Copy
The problem is I don't seem to figure out how to do this, without making "Error" sheet an Active one... Basically I want this copying to happen in the background as I need to have my current sheet Active for other purposes...
Thanks a lot
Mike
Currently I am filtering for some errors in my sheet using the following code:
Application.ScreenUpdating = False
With Cells
.Columns("A:L").AutoFilter Field:=1, Criteria1:="0"
.Rows("2:" & .Rows.Count).SpecialCells(xlCellTypeVisible).EntireRow.Copy
.Columns("A:L").AutoFilter Field:=1, Criteria1:="<>"
End With
Application.ScreenUpdating = True
So currently I just delete all the rows selected.
I would like to however add a new Sheet called "Errors" and copy the data prior deletion into this new sheet:
.Rows("2:" & .Rows.Count).SpecialCells(xlCellTypeVisible).EntireRow.Copy
.Rows("2:" & .Rows.Count).SpecialCells(xlCellTypeVisible).EntireRow.Copy
The problem is I don't seem to figure out how to do this, without making "Error" sheet an Active one... Basically I want this copying to happen in the background as I need to have my current sheet Active for other purposes...
Thanks a lot
Mike