How to disable cut, copy and paste functions in Excel?
Supposing you have a workbook with important data which you need to protect from being cut, copied and pasted. How to achieve it? This article provides a VBA method for you to disable the cut, copy and paste functions at the same time in an Excel workbook.
Disable cut, copy and paste functions with VBA code
Disable cut, copy and paste functions with VBA code
Please do as follows to disable the cut, copy and paste functions in an Excel workbook.
1. In the workbook you need to disable the cut, copy and paste functions, please press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, please double click ThisWorkbook in the left Project pane, and then copy and paste the below VBA code into the ThisWorkbook (Code) window. See screenshot:
VBA code: Disable the cut, copy and paste functions at the same time in Excel
Private Sub Workbook_Activate()
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub
Private Sub Workbook_Deactivate()
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CutCopyMode = False
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
Application.CutCopyMode = False
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub
3. Then please press the Alt + Q keys to exit the Microsoft Visual Basic for Applications window.
Now you can’t cut or copy data from this workbook, meanwhile, data you have copied from other sheets or workbooks cannot be pasted into this workbook.
Note: The drag and drop function is also disabled after running the above VBA code.
Related articles:
- How to disable right click on sheet tab in Excel?
- How to disable the right click menu in specified worksheet or whole workbook in Excel?
- How to prevent or disable edit mode by double clicking cell in Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!














