Disable copy and enable cut

shanmuganandan

New Member
Joined
Dec 14, 2017
Messages
10
I have a list of running numbers. every time i need to cut few numbers and paste at another workbook.
the reason for cut is to prevent copy same running number twice or more.

so, i need to disable copy while enabling cut and paste to another workbook.

Thanks
Shan
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It can be done but the issue will be that if the sheet is protected it will have to remain unprotected till the paste is made. Though the cut/copy paste can be disabled with out protection.
 
Upvote 0
Do you want the option for just disabling Ctrl_C? Would this be for 1 sheet?
 
Last edited:
Upvote 0
OK, there are a few bits

In ThisWorkbook
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Application
    .OnKey "^x"
    .OnKey "^c"
    .OnKey "^v"
End With


End Sub
In the sheet you want this active add
Code:
Private Sub Worksheet_Activate()
With Application
    '.OnKey "^x", "Ctrl_X_Event"
    .OnKey "^c", "Ctrl_C_Event"
    .OnKey "^v", "Ctrl_V_Event"
End With


End Sub


Private Sub Worksheet_Deactivate()
With Application
    .OnKey "^x"
    .OnKey "^c"
    .OnKey "^v"
End With


End Sub

In a Module add
Code:
Sub Ctrl_X_Event()


End Sub


Sub Ctrl_C_Event()


End Sub


Sub Ctrl_V_Event()


End Sub


NOTE the option for Ctrl-X is not enabled.
 
Last edited:
Upvote 0
Hi Nemmi,

i copy and paste the codes at their respective location but i still can copy and paste data

Thanks
Shan
 
Last edited:
Upvote 0
Why do you need to disable anything?

Microsoft already thought about this - already available..
cut with {CTRL} X
paste with {CTRL} V
 
Upvote 0
Hi Nemmi,

i copy and paste the codes at their respective location but i still can copy and paste data

Thanks
Shan

Are you able to copy/paste in the sheet with the code or is this else where?
Also are you using Ctrl_C and Ctrl_V or menu commands?
 
Upvote 0
Try this version for only 1 sheet not allowing copy/paste

In ThisWorkbook
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Application
    .OnKey "^x"
    .OnKey "^c"
    .OnKey "^v"
End With


End Sub


Private Sub Workbook_Activate()
With Application
    '.OnKey "^x", "Ctrl_X_Event"
    .OnKey "^c", "Ctrl_C_Event"
    .OnKey "^v", "Ctrl_V_Event"
End With


End Sub


Private Sub Workbook_Deactivate()
With Application
    .OnKey "^x"
    .OnKey "^c"
    .OnKey "^v"
End With


End Sub

In the sheet to be disabled
Code:
Option Explicit


Private Sub Worksheet_Activate()
With Application
    '.OnKey "^x", "Ctrl_X_Event"
    .OnKey "^c", "Ctrl_C_Event"
    .OnKey "^v", "Ctrl_V_Event"
End With


End Sub


Private Sub Worksheet_Deactivate()
With Application
    .OnKey "^x"
    .OnKey "^c"
    .OnKey "^v"
End With


End Sub

In any other sheet in that workbook
Code:
Option Explicit


Private Sub Worksheet_Activate()
With Application
    .OnKey "^x"
    .OnKey "^c"
    .OnKey "^v"
End With


End Sub

In module
Code:
Option Explicit


Sub Ctrl_X_Event()


End Sub


Sub Ctrl_C_Event()
MsgBox "Sorry, COPY is not allowed."
End Sub


Sub Ctrl_V_Event()
MsgBox "Sorry, PASTE is not allowed."
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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