Macro to filter, copy, paste data then delete copied rows

sdharlow

New Member
Joined
Apr 4, 2013
Messages
1
I have a workbook that I take a Mastersheet of data, and then filter it into 6 seperate worksheets. Each time I filter it is for data in different columns of the mastersheet. once I copy and paste that data, I want it to delete those rows from the Mastersheet. So right now my macro does this 6 times.

The problem I seem to be having is in the data deletion. Here is one of the six times my Macro does this.

ActiveSheet.Range("$A$1:$M$2635").AutoFilter Field:=12, Criteria1:=Array( _
"Approved", "Buy-off Completed", "Conditionally Approved"), Operator:= _
xlFilterValues
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Approved").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Has No PO").Select
Rows("2:2635").Select
Range("A2635").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp

The data changes in the columns of the Mastersheet, and when it does, my data deletion sometimes misses rows at the top and or bottom of the sheet. Could definitely use some help here.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
You can replace all of this:
Code:
Rows("2:2635").Select
Range("A2635").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
With this:
Code:
Rows("2:2635").Delete Shift:=xlUp
Move the Application.CutCopyMode = False line to below The ActiveSheet.Paste line
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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