jeudi 22 juillet 2021

how to set "if" criteria correctly App Script

Trying to understand how to set "if" criteria correctly. Below script works, but only if B55 is hardcoded with "yes" or "no" words. As soon as I use formula on gsheets to arrive to yes/no on B55 script doesn't recognize the results. What would be the fix there? And another question while on the topic (if I may) what would be the correct formula to write if B55 > 0 then unhide (again assuming B55 is formulated to arrive to certain number). Thanks!

function onEdit(e) { 
  var activeSheet = e.source.getActiveSheet(); 
  var range = e.range; 
  if (activeSheet.getName() !== 'Deal Inputs' || range.getA1Notation() == 'B55') {; 
    if (e.value === 'No') { 
      activeSheet.hideRows(56, 64);
    }  else if (e.value === 'Yes') { 
        activeSheet.showRows(56, 64); 
        } 
  }

Aucun commentaire:

Enregistrer un commentaire