将行移动到另一张纸并清除内容/ArrayFormula
短篇故事: 如何修改下面的脚本以清除该行中多个单元格中的内容?例如行 7,13,24,25,34
长话短说(如果有更好的解决方案):
我一直在使用此脚本根据值在工作表之间移动行,而不保留格式,以便下一张纸有自己的格式,并且条件格式不会堆积起来。
function onEditComplete(e) {
//e.source.toast('Entry');
//Logger.log(JSON.stringify(e));
const sh=e.range.getSheet();
if(sh.getName()=="Sheet1a" && e.range.columnStart==5 && e.value=="Completed") {
//e.source.toast('Conditional');
var tsh=e.source.getSheetByName("Sheet2a");
tsh.getRange(tsh.getLastRow()+1,1,1,sh.getLastColumn()).setValues(sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()).
getValues());
sh.deleteRow(e.range.rowStart);}
}
我现在遇到的问题是我正在使用公式。 我有4张。 Sheet1a 和 Sheet1b 之间有 vlookup 公式。 Sheet2a 和 Sheet2b 之间也将具有相同的 Vlookup 公式。
=ArrayFormula(IFERROR(VLOOKUP(PARTS!$B1:$B,{PARTS!$B1:$B,PARTS!$AF1:$BD&","&PARTS!$AJ1:$AJ&","&PARTS!$AN1:$AN&","&PARTS!$AR1:$AR&","&PARTS!$AV1:$AV&","&PARTS!$AR1:$AR&","&PARTS!$AZ1:$AZ},2,0)))
由于它是一个 ArrayFormula,只要设置了 Sheet2a 和 Sheet2b,它就应该只需要在移动之前清除特定单元格中的内容,因为它作为文本传输值并打破 Sheet2a 和 Sheet2b 中的公式。
Short story:
How do I modify the script below to clear contents in multiple cells in the row? For example Rows 7,13,24,25,34
Long story (in case there is a better solution):
I have been using this script to move rows between sheets based on a value without carrying over the formatting so the next sheet has its own and the conditional formatting isn't stacking up.
function onEditComplete(e) {
//e.source.toast('Entry');
//Logger.log(JSON.stringify(e));
const sh=e.range.getSheet();
if(sh.getName()=="Sheet1a" && e.range.columnStart==5 && e.value=="Completed") {
//e.source.toast('Conditional');
var tsh=e.source.getSheetByName("Sheet2a");
tsh.getRange(tsh.getLastRow()+1,1,1,sh.getLastColumn()).setValues(sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()).
getValues());
sh.deleteRow(e.range.rowStart);}
}
The problem I am encountering now is I am using Formulas.
I have 4 sheets. Sheet1a and Sheet1b have vlookup formulas between them. Sheet2a and Sheet2b will also have the same Vlookup formula between them.
=ArrayFormula(IFERROR(VLOOKUP(PARTS!$B1:$B,{PARTS!$B1:$B,PARTS!$AF1:$BD&","&PARTS!$AJ1:$AJ&","&PARTS!$AN1:$AN&","&PARTS!$AR1:$AR&","&PARTS!$AV1:$AV&","&PARTS!$AR1:$AR&","&PARTS!$AZ1:$AZ},2,0)))
Since it's an ArrayFormula, as long as Sheet2a and Sheet2b are set it should only be a matter of clearing the content in the specific cells before it moves over since it transfers as text value and breaks the formula in Sheet2a and Sheet2b.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加清除第 7、13、24、25、34 行中某些单元格的功能
Adding the ability to clear some cells in rows 7,13,24,25,34