Is it possible to hide the sheets according to the register row? I can get it done in excel sheet not sure if google sheet can do so.
I have a register showing the list of activities and the location. Each activity shown on the register is link to a google sheet and the sheets name is according to cell B4:B. The register will show the relevant row according to the drop down list in cell G2. onEdit(e) function already created to hide row when there is a change in the drop down list.
Sample of register: Imgur Picture tab name: Imgur
If the drop down list is change to hub 01 Imgur, only the relevant sheets will be shown, irrelevant sheets will remain hidden.
The first 5 sheets must be shown at all time. I try to follow the example Hide Sheets Based on a Cell Value and create a function to hide the sheet. But it hide every sheets.
function HideSheet()
{
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheets = ss.getSheets();
for ( var i=0; i<sheets.length; i++)
{
var name = sheets[i].getName();
if (name != "Site Location" ,"Risk Register", "RM team member", "Risk Matrix", "Register History")
{
var value = ss.getSheetByName('Risk Register').getRange('B4:B').getValue();
if (name.match(new RegExp(value, 'gi')))
sheets[i].showSheet();
else
sheets[i].hideSheet();
}
}
}