How To Disable Cut, Copy And Paste Functions In Excel?


For handling data and carrying out numerous calculations, Excel is a useful tool. To avoid unintentional data change or unauthorised copying, you might want to restrict some functions in some circumstances. You may maintain the integrity and security of your Excel workbooks by turning off the cut, copy, and paste functions. This article will examine various approaches to achieving this, enabling you to modify Excel's behaviour in accordance with your unique needs. Let's get going!

Disable Cut, Copy And Paste Functions

Here we will insert a VAB code for the whole workbook in order to complete the task. So let us see a simple process to learn how you can disable the cut, copy, and paste functions in Excel.

Step 1

Consider any Excel sheet. First, right−click on the sheet name and select "View Code" to open the VBA application. Then double−click on this workbook.

Right click > View code > Double click.

Step 2

Then copy the below−mentioned code into the text box, similar to the below image.

Code

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

Step 3

Then close the VBA application by using the shortcut ALT + Q to complete the task.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can disable the cut, copy, and paste functions in Excel.

Updated on: 11-Jul-2023

811 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements