Forum Discussion
Moving Rows from table on One sheet to table on other Sheet based off string value
Juliano-Petrukio Hello, I tried the link and whenever I add ByVal Target As Range in the function the macro disappears as one of my macro's and cannot be run. Here is my code below.
Private Sub MoveBasedOnValue(ByVal Target As Range)
'Move row to new spreadsheet
On Error Resume Next
Application.EnableEvents = False
'If Cell that is edited is in column B and the value is completed then
If Target.Column = 2 And Target.Value = "COMPLETED - ARCHIVE" Then
'Define last row on completed worksheet to know where to place the row of data
LrowCompleted = Sheets("Completed").Cells(Rows.Count, "A").End(xlUp).Row
'Copy and paste data
Range("A" & Target.Row & ":B" & Target.Row).Copy Sheets("Completed").Range("A" & LrowCompleted + 1).xlPasteValues
'Delete Row from Project List
Range("A" & Target.Row & ":B" & Target.Row).Delete xlShiftUp
End If
Application.EnableEvents = True
End Sub
So your code must refer to Worksheet_Change event.
- AAnger1750Aug 30, 2021Copper Contributor
Juliano-PetrukioSo I was able to get it to work but I am running into the issue of it not going to my completed sheet. It removes it from the first sheet but then disappears and does not show up where it is supposed to. I attached it if you could tell me where I messed it up.