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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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,215,694
Messages
6,126,258
Members
449,307
Latest member
Andile

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