Macro pick up range that meets criteria

NevPS

New Member
Joined
Jun 2, 2022
Messages
1
Can someone help me create a macro to pick a range of cells that meet a criteria from another cell and paste into another worksheet.
For example,I have data in A4:K300. If any row in column K = 0, I want to pick the rows that met that criteria but only pick up the data from columna A:J post to another sheet.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello NevPS,

You could try the following code:-

VBA Code:
Sub Test()

Application.ScreenUpdating = False
        
        With Sheet1.Range("K3", Sheet1.Range("K" & Sheet1.Rows.Count).End(xlUp))
                .AutoFilter 1, 0
                .Offset(1, -10).Resize(, 10).Copy Sheet2.Range("A" & Rows.Count).End(3)(2)
                .AutoFilter
        End With

Application.ScreenUpdating = True

End Sub

I'm assuming that your headings are in row3.
I've used sheet codes (Sheet1 and Sheet2) to reference your worksheets. This may need to be altered.

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,214,548
Messages
6,120,141
Members
448,948
Latest member
spamiki

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