Hello,
I have this coding below, which works really well, by automatically copying and pasting specific cells from worksheet1 onto worksheet2 when specific words are chosen in worksheet1 cell L from a drop down menu. The problem I have is that once the cells are pasted onto worksheet2, they won’t be deleted if the choice on dropdown menu in worksheet1 cell L changes. Any way to solve this? I thought of adding a subroutine to check for duplicates and delete one as no 2 records will be the same but I have no clue how to add this. Hopefully someone will be able to help me.
Thanks
I have this coding below, which works really well, by automatically copying and pasting specific cells from worksheet1 onto worksheet2 when specific words are chosen in worksheet1 cell L from a drop down menu. The problem I have is that once the cells are pasted onto worksheet2, they won’t be deleted if the choice on dropdown menu in worksheet1 cell L changes. Any way to solve this? I thought of adding a subroutine to check for duplicates and delete one as no 2 records will be the same but I have no clue how to add this. Hopefully someone will be able to help me.
Thanks
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim s As String, r, rng As Range, sh As Worksheet
Set sh = Sheets("Decision")
s = "Exit from this plan and entering another"
If Target.Count > 1 Then Exit Sub
If Target.Column = 12 Then
If Target = s Then
r = Target.Row
Set rng = Range("A" & r & ":H" & r)
With sh
rng.Copy .Cells(.Rows.Count, "A").End(xlUp).Offset(1)
End With
End If
End If
End Sub
Last edited by a moderator: