0

Below is my script or code:

function myFunction() {

}
function onEdit() {
  var s = SpreadsheetApp.getActive().getSheetByName('Sheet1');
  s.showRows(1, s.getMaxRows());

  s.getRange('H:H')
    .getValues()
    .forEach( function (r, i) {
    if (r[0] == 'Complete') 
      s.hideRows(i + 1);
    });
}

I would like this script to work on multiple tabs such as Sheet2, Sheet3, etc.

I have looked all over for a script that would work with mine to make it work on multiple tabs. If you know how to do this, please help!

0

Replace

var s = SpreadsheetApp.getActive().getSheetByName('Sheet1');

by

var s = SpreadsheetApp.getActiveSheet();

The above line will assign the sheet that was edited to s.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.