VBA to copy from filtered range

MaxK38

New Member
Joined
Feb 18, 2010
Messages
37
I am having trouble automating the copying from a spreadsheet after a filter is applied. For example 1.) filter for containing "test" in a column 2.) copy results in column from range (First Cell:Last Cell) in filtered results. Currently I use code that due to differing results of files, I am selecting a huge range (11000) and as a result, the code is running slow due to size of data on the clipboard. How do I copy from the first to the last occurrence from results after a filter using VBA?

Code:
Rows("3:3").Select
                Selection.AutoFilter
                ActiveSheet.Range("A3:G11000").AutoFilter Field:=1, Criteria1:= _
                UsrRef, Operator:=xlAnd
                          
                'Copy members of group (DC has more than 3,000 rows)
                Range("A3:G11000").Select
                Application.CutCopyMode = False
                Selection.SpecialCells(xlCellTypeVisible).Copy
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Watch MrExcel Video

Forum statistics

Threads
1,123,523
Messages
5,602,164
Members
414,508
Latest member
Yaya1900

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