Hi, I have a worksheet change event which works fine as is, if new data is pasted into the range.
How can it be stopped if the range is cleared or deleted?
How can it be stopped if the range is cleared or deleted?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Long
Dim rng2 As Long
With ActiveSheet
rng = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
On Error Resume Next 'skip all run-time errors
Application.EnableEvents = False
If Target.Column > 4 Then
Range("A1:2" & rng).Copy
With Sheets("WTD")
rng2 = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Range("A" & rng2).PasteSpecial xlPasteAll
End With
End If
Application.EnableEvents = True
On Error GoTo 0 'Turn off error trapping and re-allow run time errors
MsgBox "Daily Data copied to the WTD Tab"
End Sub