[英]How can I create a script that will lock specific cells base on dropdown?
如果选择培训报告,则要输入橙色的数据,而另一种颜色则被锁定。
如果选择会议报告,我想输入橙色的数据,而另一种颜色则被锁定。
如果选择教练报告,则要输入橙色数据,而另一种颜色则被锁定。
您可以尝试, Class Protection
访问和修改受保护的范围和工作表。 受保护范围可以保护单元格的静态范围或命名范围。
// Protect range A1:B10, then remove all other users from the list of editors.
var ss = SpreadsheetApp.getActive();
var range = ss.getRange('A1:B10');
var protection = range.protect().setDescription('Sample protected range');
// Ensure the current user is an editor before removing others. Otherwise, if the user's edit
// permission comes from a group, the script will throw an exception upon removing the group.
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
protection.setDomainEdit(false);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.