I have created several drop-down menus, what I would like to know is, is it possible and if so how do I create a script so that once a user has finished with the sheet they press a button or it self resets itself to the top value or better blank as per the black drop-downs in the screenshot?
I have attached a simple screenshot of the tabs in question, if you need more info please ask.
Best Answer
You want a user to be able to clear a series of dropdown cells by clicking a button.
An excellent answer is found in Google Support from Dec 2016. Since this is an external source, I have adapted and expanded it here. Props to "Munkey (David)" who supplied the original answer.
The script to clear/reset the dropdown value is very simple and uses the method
.clearContent()
. When the dropdown cells are cleared, the values for "Position score" and "Position Explanation" (which, in my test data, are based onVLOOKUP
formula) become blank by virtue of usingIFERROR
in conjunction with theVLOOKUP
.However... you have several ranges to reset and there are options for describing those ranges.
1 - refer to specified range (such as "B5:F5"). This will work well, but in the event that you insert a row, expand the spreadsheet, etc, then the script would need to be edited.
2 - refer to a named range (such as "DropdownSet1"). A named range will be updated as rows are added or deleted, and this avoids editing of the script.
This solution doesn't offer a button option; instead the trigger to clear the dropdowns is included in a custom menu. You should delete whichever option you don't wish to use.
Before
After