Question Re: Copying a Range after filtering

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343
Hello,

If i have used autofilter to select certain value in a field what is the best code to use to copy the results? I would be looking to only copy the rows that have information in them and the number of results would differ each time.

Thanks for your help,

TD Rich.:eek:
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
have a look at .specialcells(xlcelltypevisible).

If you know the dimensions of your unfiltered table and where it starts you can use

range("A5:A100").specialcells(xlcelltypevisible).entirerow.copy

You'll need to error handle in case there are no visible cells in the range.

HTH
 
Upvote 0
Thanks for the info.

So, if i understand it right and my table (unfiltered) started at A3 and ran for say 100 rows. It would look like this:

Columns("J:J").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=App", Operator:=xlAnd
range("A5:A100").specialcells(xlcelltypevisible).entirerow.copy

?

Cheers,

TD Rich
 
Upvote 0

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

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