Normally what I do many times is run the macro recorder and sometimes just simplify or slightly modify it's code. Here's some code the Macro Recorder made to filter some data and copy it to two columns on another worksheet:
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="John"
Columns("A:B").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Range("C7").Select
That could be reduced down to:
Cells.AutoFilter Field:=1, Criteria1:="John"
Columns("A:B").SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet2").Range("A1").Paste
Basically, if you look at what I did. I got rid of all the Selects and I'm telling Excel how to do it directly.
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="John"
If you take out all of the selecting and extra steps on this, it becomes:
Cells.AutoFilter Field:=1, Criteria1:="John"
On the next section:
Columns("A:B").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Removing all of the selecting gives you:
Columns("A:B").SpecialCells(xlCellTypeVisible).Copy
By elimininating all of the selecting you make the macro shorter and make it do less process and thereby take up less space and run faster.
Now, if I wanted to copy over the data I put into Columns A and B in Sheet 2, it would be best to first clear the contents of Columns A and B on Sheet2. So I might change it to something like this:
Sheets("Sheet2").Columns("A:B").ClearContents
Sheets("Sheet1").Cells.AutoFilter Field:=1, Criteria1:="John"
Columns("A:B").SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet2").Range("A1").Paste