Macro select filtered worksheet

Galceran

Board Regular
Joined
Nov 8, 2008
Messages
177
I have a database in Excel 2003 with 794 rows. A macro filters the worksheet correctly. I now want it to select the filtered output (129 rows) so it can be copied to another worksheet for further formatting. I cannot get the code to select columns A:C down to the last row.
Thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
With the filter in place (so all you can see is what you wish to copy/paste):

Code:
Cells.SpecialCells(xlCellTypeVisible).Copy `Enter location you with to paste here!!
 
Upvote 0
In case this might help, here is a macro I wrote and use that does a similar function (copies filter cells and pastes them to new location):

In this example I am on Sheet "All Assets" using the autofilter function to copy/paste filtered results to new worksheets.

Code:
With Sheets("All Assets").Cells
    .AutoFilter
    .AutoFilter Field:=1, Criteria1:="Line10"
    .SpecialCells(xlCellTypeVisible).Copy
    Sheets("Line10").Paste
    .AutoFilter Field:=1, Criteria1:="Flowline"
    .SpecialCells(xlCellTypeVisible).Copy
    Sheets("Flowline").Paste
    .AutoFilter Field:=1, Criteria1:="Lamination"
    .SpecialCells(xlCellTypeVisible).Copy
    Sheets("Lamination").Paste
    .AutoFilter Field:=1, Criteria1:="Grinding"
    .SpecialCells(xlCellTypeVisible).Copy
    Sheets("Grinding").Paste
    .AutoFilter Field:=1, Criteria1:="=*Line*"
    .SpecialCells(xlCellTypeVisible).Copy
    Sheets("All Production").Paste
    .AutoFilter
End With

I didn't see you specify you wanted only columns A and C...

Code:
Range("A:A,C:C").SpecialCells(xlCellTypeVisible).Copy `select destination for paste
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top