VBA Code Help with Moving Rows

snaplink22

Board Regular
Joined
Jul 6, 2018
Messages
129
Hello,

I am attempting to move any of the rows in my first sheet to the second sheet when my drop down list changes from any other option to "Completed" in column A. Here is the code I have currently, but it's not working:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Application.EnableEvents = False
If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
On Error GoTo errhandler
If Target = "Completed" Then
Target.EntireRow.Copy Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Target.EntireRow.Delete
End If
Application.ScreenUpdating = True
errhandler:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

If possible, I would also like to have that same option pull that row back to Sheet1 if any of the drop down options other than "Completed" is changed.
 
Because you have deleted the row, there is no way you can change Completed to anything else. :unsure:

Hmm, I thought if I put Sheet!N1:N5 in my drop down list when it moved over to Sheet2 it would keep that list, but it doesn't appear to be the case. No worries though, I just can just copy/insert that row back over if I select Completed by mistake. Thank you very much Fluff for your help and walking me through this new and confusing process!
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

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