I have an inventory list in one tab with all the items including barcodes for every item. On the far right side of the sheet, I have code that when a checkbox is selected, the item row information is copied over to another tab which is our checkout page. The checkbox is included on this page, and it stays selected. I really want to be able to deselect the checkbox, which would delete the row from the checkout tab, and deselect the checkbox from the inventory tab. Is there a way to do this? At the very least, I would love to be able to deselect the checkbox on the checkout tab which would automatically deselect the same checkbox on the inventory tab, and then manually delete the row. Is any of this possible? here is my current code:
I have tried to find other posts, but anything that involves deselecting a box will create a new row at the bottom. This isn't what I want since my inventory list is in order from a barcode, and I don't want to create duplicates.
function onEdit(event) {
// assumes source data in sheet named main
// target sheet of move to named Completed
// getColumn with check-boxes is currently set to colu 4 or D
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(s.getName() == "Tech Lending" && r.getColumn() == 5 && r.getValue() == true) {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Check-out");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).copyTo(target);
}
}
Aucun commentaire:
Enregistrer un commentaire