Disable "CUT" in excel + vb

This will disable the user from using ctrl + X (i.e. cut) option in excel.


Sub ctrlX()
MsgBox "You are not allowed to Cut a cell. You can use copy instead."
End Sub


Sub disableCut()
'Disable Cut button
Application.CommandBars("Standard").Controls.Item("Cut").Enabled = False

Application.CommandBars("Edit").Controls.Item("Cut").Enabled = False
Application.OnKey "^x", "ctrlX"
Application.CellDragAndDrop = False

End Sub


Comments

Guest Author: Rajiv05 Jul 2012

how do we enable the function ctrl+x if it is been diabled

Author: RB11 Jul 2012 Member Level: Bronze   Points : 0

I tried this in excel & it works.

How can I revert back to original settings?

Pls share the detailed steps.

I am not a VBA expert. I dont have file in which I saved above script.

But this script works every time I press Ctrl+X.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: