[英]Block a cell from being edited based on the value in another cell in Google spreadsheet
I am trying to figure out how to block a cell based on the value in another adjacent cell in my Google spreadsheet. 我正在尝试找出如何根据我的Google电子表格中另一个相邻单元格中的值来阻止一个单元格。
In my Google spreadsheet, both column A and column B have a dropdown list. 在我的Google电子表格中,列A和列B都有一个下拉列表。 I want cell B1 to be locked if a particular item is selected from the dropdown in column A.
如果要从A列的下拉列表中选择特定项目,我希望单元格B1被锁定。
I ran across a link that is similar, but I do not know how to adjust it to meet my needs. 我遇到了一个相似的链接,但是我不知道如何调整它以满足我的需求。 Is this something that can be done?
这是可以做到的吗?
To monitor the state of a certain cell, you can use either a simple or installable trigger. 要监视某个单元的状态,可以使用简单或可安装的触发器。 A simple trigger only needs a certain function name, no other setting.
一个简单的触发器只需要一个特定的功能名称,而无需其他设置。
function onEdit(e){
// Get what range was edited
var range = e.range;
//Check the range address
if (range === "A1") { //If range edited was the cell A1, then do something
//Get the value in the edited cell
var valueInCell = e.value;
//Run a condition check
if (valueInCell === edit Value Here) {
//Get reference to cell to act upon
//To Do: code here
//Do something to cell
//To Do: code here
};
};
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.