VBA Lock Ctrl V in only 1 sheet

Excelpromax123

Board Regular
Joined
Sep 2, 2021
Messages
167
Office Version
  1. 2010
Platform
  1. Windows
I want to lock Ctrl V for only 1 sheet . But still want to allow copying from one file to another, and files without the above code can still Ctrl V. I'm currently using the code below, but it doesn't allow Ctrl V to move to another file. Thank you !

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.OnKey "^v", ""
End Sub
Private Sub Worksheet_Deactivate()
Application.OnKey "^v"
End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
When I use this code I can copy and paste to other workbooks and to other applications, but I cannot paste in the same workbook

VBA Code:
Private Sub Worksheet_Deactivate()
  Application.CutCopyMode = False
  
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,382
Members
449,155
Latest member
ravioli44

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