The below code disables cut/copy/paste in a worksheet
Is there a way to make it only work when a certain range is selected, e.g. range(a1:a10")? In short users should be able to cut copy and paste except only on a1:a10?
Code:
Private Sub worksheet_activate()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub
Private Sub worksheet_deactivate()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub
Is there a way to make it only work when a certain range is selected, e.g. range(a1:a10")? In short users should be able to cut copy and paste except only on a1:a10?