Macro's : Cut/Paste from One Sheet to Another

wtknsphil

New Member
Joined
Sep 20, 2017
Messages
15
Hi all,

Long-time lurker now registered. Looking for a bit of help.

I did a search on here for taking a row, for example from "Sheet1" and moving it to "Sheet2". The code works in principle however on occasion it takes two rows across. The key word is "YES" in column 'i' and the macro is enabled with a button.

Could anyone advise why it sometimes takes two rows, even though I'm only putting "yes" in one row?

Thanks in advance :)

Code:
Sub Button1_Click()
     
    Application.ScreenUpdating = False
    Columns(9).AutoFilter 1, "Yes"
    With Range("a2", Range("i" & Rows.Count).End(3))
        .Copy Sheet2.Cells(Rows.Count, 1).End(3).Offset(1)
        .EntireRow.Delete
    End With
    Columns(9).AutoFilter
    Application.ScreenUpdating = True
    Selection.AutoFilter
     
End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Excellent Wtknsphil! Glad that you sorted it out.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,982
Members
449,201
Latest member
Lunzwe73

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