I am attempting to have a macro cut a row from one worksheet to another whenever a cell in Column G is changed to "Closed."
The Code I have operating is: (supplied by helpful forum regulator #shoutout My Answer is This)
Thoughts?
Also, does this code work after a filter has been applied to the data?
The Code I have operating is: (supplied by helpful forum regulator #shoutout My Answer is This)
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G:G")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim ans As Long
Dim Lastrowa As Long
Lastrowa = Sheets("Closed Projects").Cells(Rows.Count, "G").End(xlUp).Row + 1
If Target.Value = "Closed" Then Rows(Target.Row).Cut Destination:=Sheets("Closed Projects").Rows(Lastrowa)
End If
End Sub
When this works its magic, it effectively copies the row to the next page instead of cutting the row. It leaves empty rows in its wake that have to be manually deleted.If Not Intersect(Target, Range("G:G")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim ans As Long
Dim Lastrowa As Long
Lastrowa = Sheets("Closed Projects").Cells(Rows.Count, "G").End(xlUp).Row + 1
If Target.Value = "Closed" Then Rows(Target.Row).Cut Destination:=Sheets("Closed Projects").Rows(Lastrowa)
End If
End Sub
Thoughts?
Also, does this code work after a filter has been applied to the data?