Re-enabling Copy, Cut, Paste, Drag/Drop Cells in Excel

Ndifreke

New Member
Joined
Oct 10, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi Team,

I recent use the code below into the ThisWorkbook section of the VBA to disable cut, copy, paste and cell drag.

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


Unfortunately while I thought this would only apply to the Workbook I was working on, it has affected all Excel Workbooks on my PC.

I can no longer copy using CTRL + C, cut, paste nor drag & drop cells.

Please how do I re-enable all these functions on my Excel?

Thanks in advance
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Did you try removing ALL of that code from your workbook, then close Excel entirely and log back in to it and see if that resets everything?
 
Upvote 0
Solution
I am guessing that a macro as below should restore it.
VBA Code:
Sub RestoreC
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub

It may need to go in here
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
 
Upvote 0
Did you try removing ALL of that code from your workbook, then close Excel entirely and log back in to it and see if that resets everything?
This did for me. I cleared everything from the ThisWorkbook, closed Excel and re-oponed it to be pleasantly surprised that the issue was solved.

Many thanks
I am guessing that a macro as below should restore it.
VBA Code:
Sub RestoreC
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub

It may need to go in here
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Hi nemmi69,

Thank you so much for the feedback. I am now able to carry-out all cut, copy, paste, drag & drop functions on my Excel.

Many thanks!!!
 
Upvote 0
This did for me.
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top