I'm trying to hide certain rows based on checkboxes that are checked in column 'C'.
Simply put if 'Option A' is checked, I only want to show rows 11 - 13, and row 22. If 'Option B' is checked. I only want to show rows 14 - 15, and row 22, etc.
I also would like to have them revert back after I uncheck. This is more of a learning exercise than anything, so I will get to 'checking multiple boxes' later.
I'm wondering if there should be some 'for' logic in there as well? I'm just not sure where...
Any help or recommendations would be greatly appreciated! Happy to get into more detail if need be.
Thanks a lot,
-M
How about this modification? I think that there are several answers for your situation. So please think of this as one of them.
Modification points :
onEdit()
. This was mentioned by @I'-'I.Modified script :
When you use this modified script,
onEdit()
functions in your project.cfg
. For example, when there is a checkbox at "C7" and the rows are from row 11 to row 13, please setC7: {startRow: 11, endRow: 13}
.Note :
if (cfg[activeRange] && e.source.getSheetName() == "### sheet name ###") {
.Rererence :
If I misunderstand your question, please tell me. I would like to modify it.
Edit :
You want to show all rows without hiding, when users open the Spreadsheet. If my understanding is correct, how about this?
onOpen()
can be used for running when the spreadsheet is opened.cfg
as a global variable.true
ofsheet.getRange(ranges[0] + ":" + ranges[ranges.length - 1]).setValue(true);
is modified tofalse
, when the spreadsheet is opened, all checkboxes are no check and all rows are shown.