Hi All,
I'm not an experienced programmer and I've been trying to use the code below to prevent users from deleting / adding rows or columns in a particular spreadsheet. However, it is not working at all. I properly inserted the code in the object "Worksheet".
Can you please help?
MANY TKS!
Code
- [B]Private Sub Worksheet_SelectionChange(ByVal Target As Range)[/B]
- [B]If ((Target.Address = Target.EntireRow.Address Or Target.Address = Target.EntireColumn.Address)) Then[/B]
- [B] With Application[/B]
- [B] .EnableEvents = False[/B]
- [B] .Undo[/B]
- [B] MsgBox "No deleting rows or columns", 16[/B]
- [B] .EnableEvents = True[/B]
- [B] End With[/B]
- [B]Else[/B]
- [B]End If[/B]
- [B]End Sub[/B]