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:
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
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
 

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343
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
 

Watch MrExcel Video

Forum statistics

Threads
1,123,259
Messages
5,600,575
Members
414,390
Latest member
plimbu

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
Top