Copy and paste filtered data

ZaneCOYS

New Member
Joined
Nov 23, 2010
Messages
24
Hi,

I am looking to copy data from one worksheets to another. I will be filtering on column "U" using an array to show the 'to be filtered by' data. The code I have for this is:

For d = 1 To 21
Worksheets("Raw Data wo ACT").Activate
Range("U1").Select
Selection.AutoFilter Field:=21, Criteria1:=data_info(d, 1)

Next d

I now need to Copy the filtered data from Columns E,F,H,R,S,T. and paste to another worksheet. To make this more complex the destination of the paste is diferent for each filter.

please help as I seem to be going around in circles.
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Something along these lines:
Code:
Dim LR As Long
Dim wsDest As Worksheet

Set wsDest = Sheets("Report")

With Worksheets("Raw Data wo ACT")
    .AutoFilterMode = False
    .Rows(1).AutoFilter

    For d = 1 To 21
        .Rows(1).AutoFilter Field:=21, Criteria1:=data_info(d, 1)
        LR = .Range("U" & .Rows.Count).End(xlUp).Row
        If LR > 1 Then _
            .Range("E2:F" & LR & _
                  ",H2:H" & LR & _
                  ",R2:T" & LR).Copy _
                wsDest.Range("A" & Rows.Count).End(xlUp).Offset(1)
    Next d

    .AutoFilterMode = False
End With
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,688
Members
449,117
Latest member
Aaagu

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