简体   繁体   English

使用VBA保护Excel中的特定区域

[英]Protect specific area in excel with vba

I wanna proctect a specific area or only rows in a excel sheet where the user can make changes. 我想保护一个特定区域或仅在Excel工作表中的行供用户更改。

我的Excel工作表

the red area should be protected, is this possible and realizeable with vba? 红色区域应该受到保护,这可以通过vba实现吗? And is it possible to make the protec scalable , when the user insert a new line? 当用户插入新行时,是否可以使protec 可扩展

Thanks for your suggestion!, I know my english is no quite good... -.- 谢谢您的建议!,我知道我的英语不太好... -.-

I know ther are exist many question about this subject but i didn't found the right answer in following question: 我知道关于这个主题存在很多问题,但是在以下问题中我没有找到正确的答案:

I hope you can help me... 我希望你能帮帮我...

You first have to pick which cells aren't protected by setting the Locked to false 您首先必须通过将Locked设置为false来选择哪些单元格不受保护

Worksheets("Main").Range("B2:E4").Locked = False

Then you have to use to modify the cells 然后,您必须使用修改单元格

Worksheets("Main").Protect UserInterfaceOnly:=True

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

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