Move a row to another sheet based on cell value

NRIANS2123

New Member
Joined
Jun 17, 2019
Messages
6
Hello,

I've been using this site for awhile now and it's been very helpful. Thanks. In most cases, I could find what I need or at least find something close enough that I could modify it to work. I've tried the same approach this round, with no luck. My excel document has 2 sheets that I'm working with "Report" and "Backlog (Amazon)". What I'm trying to do is use a button to move rows from "Report" to ""Backlog (Amazon)" and clear content from "Report" based on column B containing the words "Amazon" or "Golden State". What I'm struggling with is the "containing" aspect. Each row that I want to move will have Amazon or Golden State in it, but with multiple variations (Amazon.com INC, Amazon.com Services, INC, etc.). Any help is much appreciated.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
see if this will work for you.

Code:
Sub t()
Dim sh1 As Worksheet, sh2 As Worksheet, rng As Range
Set sh1 = Sheets("Report")
Set sh2 = Sheets("Backlog (Amazon)")
Set rng = sh1.Range("B1", sh1.Cells(Rows.Count, 2).End(xlUp))
rng.AutoFilter 1, "*Amazon*", xlOr, "*Golden State*"
rng.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Copy sh2.Cells(Rows.Count, 1).End(xlUp)(2)
rng.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.ClearContents
sh1.AutoFilterMode = False
End Sub
 
Upvote 0
One last question. Is there a way to tweek the line in red to only past columns A thru BD instead of the entire row?

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Dim sh1 As Worksheet, sh2 As Worksheet, rng As Range
Set sh1 = Sheets("Report")
Set sh2 = Sheets("Backlog Report (Amazon)")
Set rng = sh1.Range("B1", sh1.Cells(Rows.Count, 2).End(xlUp))
rng.AutoFilter 1, "*Amazon*", xlOr, "*Golden State*"
rng.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Copy sh2.Cells(Rows.Count, 1).End(xlUp)(2)
rng.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.ClearContents
sh1.AutoFilterMode = False[/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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