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.
 

snaplink22

Board Regular
Joined
Jul 6, 2018
Messages
129
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!
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,597
Messages
5,625,729
Members
416,130
Latest member
galgozzi

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
Top