Skip to content

Instantly share code, notes, and snippets.

@LockeBirdsey
Created February 3, 2020 14:34
Show Gist options
  • Save LockeBirdsey/746c0f99b3b75960c8bc9b6d86a0f576 to your computer and use it in GitHub Desktop.
Save LockeBirdsey/746c0f99b3b75960c8bc9b6d86a0f576 to your computer and use it in GitHub Desktop.
function onEdit(e) {
var sheet = SpreadsheetApp.getActive().getActiveSheet();
//Get the final potential rows
var row = 10;
var varA = SpreadsheetApp.getActiveSheet().getRange(row, 4).getValue();
var varB = SpreadsheetApp.getActiveSheet().getRange(row, 5).getValue();
var varC = SpreadsheetApp.getActiveSheet().getRange(row, 6).getValue();
var varD = SpreadsheetApp.getActiveSheet().getRange(row, 7).getValue();
var varE = SpreadsheetApp.getActiveSheet().getRange(row, 8).getValue();
//resizing rows
var startRow = 12;
var endRow = 13;
var numCols = 8;
var numRows = endRow - startRow + 1; //Needs to be inclusive [x,y] not [x,y)
var rowRanges = sheet.getRange(startRow, numCols, numRows)
if (varA == "" || varB == ""
|| varC == ""|| varD == ""
|| varE == "") {
//hide the rows since they have nothing in them
sheet.hideRow(rowRanges)
} else {
sheet.unhideRow(rowRanges)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment