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!

1 Answer 1

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.

1
  • You, Sir, are a genius!! THANK YOU Jan 11, 2019 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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