SaraWitch
Active Member
- Joined
- Sep 29, 2015
- Messages
- 377
- Office Version
- 365
- Platform
- Windows
Hello peeps,
In a protected sheet ("Placements"), I have a formula in column U that calculates a date from a range of other cells. When a date is populated, I want the row to automatically delete and paste into another protected sheet ("Leavers"). I think I'm almost there with the formula below but know I have to change the <> in line 4 (I've tried some date text but it doesn't work).
Any help would be gratefully received
In a protected sheet ("Placements"), I have a formula in column U that calculates a date from a range of other cells. When a date is populated, I want the row to automatically delete and paste into another protected sheet ("Leavers"). I think I'm almost there with the formula below but know I have to change the <> in line 4 (I've tried some date text but it doesn't work).
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect ("password")
Dim NextRow As Long
If Target.Column <> 21 Then Exit Sub
Application.EnableEvents = False
With Sheets("Leavers")
NextRow = .Cells(Rows.Count, 8).End(xlUp).Row + 1
Target.EntireRow.Copy Destination:=.Cells(NextRow, 1)
Target.EntireRow.Delete
End With
Application.EnableEvents = True
ActiveSheet.Protect ("password")
End Sub
Any help would be gratefully received