tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,832
- Office Version
- 365
- 2019
- Platform
- Windows
Assume I have the following formatted as an Excel table:
I would to prevent users from deleting the table (essentially prevent row 1 from being deleted).
This is my code but it doesn't work:
If the user selects row 1 and presses the delete key (ie clear contents), I see this:
How can I amend my code to prevent users deleting row 1?
Thanks
I would to prevent users from deleting the table (essentially prevent row 1 from being deleted).
This is my code but it doesn't work:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub
If the user selects row 1 and presses the delete key (ie clear contents), I see this:
How can I amend my code to prevent users deleting row 1?
Thanks