--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/5f7c6579-8515-4915-a353-85143c481513n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAFX%2Bz3UaWZtXFjEPg_rSz24vCtAyLwE5MGnTKoRK0-wQ4DpWmQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAGhk4pBp0GivXt1Q9f335qktfj7suO66fNHRR-vwSP%3DbO7rwRg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAFX%2Bz3XK4mD9x%2BsUENhE_dKWsQVnW5v4ocDKsynZPCRDH8p89Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAGhk4pCsXcQuJD6fu83hj_T9mKycESnCNERq0%3DKEJpxG%2Bcvy4w%40mail.gmail.com.
Try this:
/**
* TITLE:
* Hide a row if a value is inputted.
*/
//**GLOBALS**
// Sheet the data is on.
var SHEET = ["Copy of Shop Notes","Copy of Road Notes"];
// The value that will cause the row to hide.
var VALUE = "x";
// The column we will be using
const COLUMN_NUMBER = [6,7];
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = ss.getActiveSheet();
const sheetName = activeSheet.getName();
const sheetIndex = SHEET.indexOf(sheetName);
//Ensure on correct sheet. (sheetIndex is 0 or higher if active sheet is in array SHEET)
if(sheetIndex >=0 ){
var cell = ss.getActiveCell();
var row = cell.getRow();
var col = cell.getColumn();
var cellValue = cell.getValue();
//Ensure we are looking at the correct column.
if(col == COLUMN_NUMBER[sheetIndex]){
//If the cell matched the value we require,hide the row.
if(cellValue == VALUE){
activeSheet.hideRow(row);
};
};
};
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAGhk4pCsXcQuJD6fu83hj_T9mKycESnCNERq0%3DKEJpxG%2Bcvy4w%40mail.gmail.com.
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/JLIvAC5dzfs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/006e01d8a05f%24e432a050%24ac97e0f0%24%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAGhk4pCfLAoi4XO53%2Bp7DqyQGJEXmFheAwFDnYT29-DOZz5LTw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAJ8MD4w1wuA9f7acaAiTXbWOO-do-9GXHM429EdLyCbNANq3qg%40mail.gmail.com.