Hello to you all! I hope you all are doing well during this pandemic.
Before I begin please understand I am not an excel wiz by any means, and messing with VBA is a very weak point for me. With that said, I would like to get some help with moving rows when the completed column shows "Y" to the closed discrepancies tab.Here is what I have thus far.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Application.EnableEvents = False
'If Cell that is edited is in column M and the value is completed then
If Target.Column = 12 And Target.Value = "yes" Then
'Define last row on completed worksheet to know where to place the row of data
LrowCompleted = Sheets("Closed Discrepancies").Cells(Rows.Count, "A").End(xlUp).Row
'Copy and paste data
Range("A" & Target.Row & ":M" & Target.Row).CopySheets("Closed Discrepancies").Range("A" & LrowCompleted + 1).PasteSpecial Paste:=xlPasteValues
'Delete Row from Open Discrepancies
Range("A" & Target.Row & ":M" & Target.Row).Delete xlShiftUp
End If
Application.EnableEvents = True
End Sub
Thank you in advance for your help! I am truly appreciative for those of you that take the time to assist.
Before I begin please understand I am not an excel wiz by any means, and messing with VBA is a very weak point for me. With that said, I would like to get some help with moving rows when the completed column shows "Y" to the closed discrepancies tab.Here is what I have thus far.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Application.EnableEvents = False
'If Cell that is edited is in column M and the value is completed then
If Target.Column = 12 And Target.Value = "yes" Then
'Define last row on completed worksheet to know where to place the row of data
LrowCompleted = Sheets("Closed Discrepancies").Cells(Rows.Count, "A").End(xlUp).Row
'Copy and paste data
Range("A" & Target.Row & ":M" & Target.Row).CopySheets("Closed Discrepancies").Range("A" & LrowCompleted + 1).PasteSpecial Paste:=xlPasteValues
'Delete Row from Open Discrepancies
Range("A" & Target.Row & ":M" & Target.Row).Delete xlShiftUp
End If
Application.EnableEvents = True
End Sub
Thank you in advance for your help! I am truly appreciative for those of you that take the time to assist.