Move Rows to another sheet based on cell value

camronmartin

New Member
Joined
Oct 28, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Excel Snip.PNG
Hi There,

Super beginner excel user. I am trying to figure out how to move the contents of a row from my Requested Sheet to my Received Sheet once I type "Yes" into Column D. Help please.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try this:
You must have a sheet named "Received"
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab Named Requested
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
When you enter "Yes" in Column D the row will be copied to sheet named Received
And delete row from sheet named Requested.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  10/28/2020  10:34:55 PM  EDT
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
If Target.Column = 4 And Target.Value = "Yes" Then
Dim Lastrow As Long
Lastrow = Sheets("Received").Cells(Rows.Count, "D").End(xlUp).Row + 1
Rows(Target.Row).Copy Sheets("Received").Cells(Lastrow, 1)
Rows(Target.Row).Delete
End If
End Sub
 
Upvote 0
Try this:
You must have a sheet named "Received"
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab Named Requested
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
When you enter "Yes" in Column D the row will be copied to sheet named Received
And delete row from sheet named Requested.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  10/28/2020  10:34:55 PM  EDT
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
If Target.Column = 4 And Target.Value = "Yes" Then
Dim Lastrow As Long
Lastrow = Sheets("Received").Cells(Rows.Count, "D").End(xlUp).Row + 1
Rows(Target.Row).Copy Sheets("Received").Cells(Lastrow, 1)
Rows(Target.Row).Delete
End If
End Sub
That worked perfectly, thank you!
 
Upvote 0

Forum statistics

Threads
1,216,156
Messages
6,129,188
Members
449,492
Latest member
steveg127

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