vba 在受保护工作表上的未锁定单元格中禁用复制/粘贴?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28192796/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Disable copy/paste in unlocked cells on protected sheet?
提问by user1283776
Is it possible to disable copy/paste in unlocked cells on protected sheet?
是否可以在受保护工作表上的未锁定单元格中禁用复制/粘贴?
My specific problem is that while users should be able to edit unlocked cells, they should not copy data validation from one cell to another. Unfortunately data validation gets copied in a normal copy/paste operation.
我的具体问题是,虽然用户应该能够编辑未锁定的单元格,但他们不应将数据验证从一个单元格复制到另一个单元格。不幸的是,数据验证在正常的复制/粘贴操作中被复制。
So is it possible to disable copy/paste in unlocked cells on protected sheet or change the behavior of data validation so that it is not affected by copy/paste?
那么是否可以在受保护工作表上的未锁定单元格中禁用复制/粘贴或更改数据验证的行为,使其不受复制/粘贴的影响?
The suggested solution can be either Excel or VBA.
建议的解决方案可以是 Excel 或 VBA。
回答by Vasily
try this
尝试这个
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.CutCopyMode = False
End Sub
put this code inside sheet
将此代码放在工作表中