简体   繁体   English

Excel VBA Protect工作表,但允许复制

[英]Excel VBA Protect worksheet but allow copy

I'm using Excel 2010 and protect using the following line in VBA: 我正在使用Excel 2010,并在VBA中使用以下行进行保护:

Worksheets("GL Codes").Protect Password:="xxxxxxxxx", AllowFiltering:=True, AllowFormattingCells:=True

However, I now receive an error when I double-click to run the below: 但是,当我双击运行以下命令时,现在收到错误消息:

Range("A" & Target.Row).Copy Destination:=Range("A2")

How do I protect but still allow a copy via VBA? 如何保护但仍允许通过VBA复制?

Sorted it! 排序!

Just removed the 'locked' protection checkbox for cell A2 刚刚删除了单元格A2的“锁定”保护复选框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM