我的If声明如果没有决定“rb”是否在设置的水平单元格中
我知道这个脚本非常粗糙,并且有更多方法可以进行这种类型的查找,但这是我第一次编码。如果有人可以帮助我的代码,甚至建议更好的方法来做这个我会做研究,真的很感激
{
function sortAndSeperate() {
var i = 3;
var days = 11
var d =SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Coming Up work").getRange(2, 11);
var sheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Coming Up work");
var worker = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Reuben");
var rangeMonday =sheet1.getRange(i,1,1,10)
//var rangeTuesday=sheet1.getRange(row, column, numRows, numColumns)
var copyrange = worker.getRange(i - 1, 1, 1, 10)
if (rangeMonday = "rb") {
var paste =SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Coming Up work").getRange(i,1,1,10).copyTo(copyrange)
var dateis = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Coming Up work").getRange(2 , days )
var paste2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Reuben").getRange(i - 1,5)
var paste3 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Reuben").getRange(i - 1,6)
dateis.copyTo(paste2)
dateis.copyTo(paste3)
}
else {
Logger.log('It is finished.');
}
答案 0 :(得分:0)
您需要一个双重或三等号,即==
或===
if (rangeMonday === "rb") {
var paste = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Coming Up work").getRange(i, 1, 1, 10).copyTo(copyrange)
var dateis = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Coming Up work").getRange(2, days)
var paste2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Reuben").getRange(i - 1, 5)
var paste3 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Reuben").getRange(i - 1, 6)
dateis.copyTo(paste2)
dateis.copyTo(paste3)
} else {
Logger.log('It is finished.');
}
答案 1 :(得分:0)
if(x ==。Single =赋值不比较