Created
May 24, 2022 15:37
-
-
Save ricardomaia/456fda906f4c4f3ab22703d0560932b5 to your computer and use it in GitHub Desktop.
Multiple Selections on Google Spreadsheets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
@OnlyCurrentDoc | |
Ref: https://spreadsheetpoint.com/multiple-selection-drop-down-google-sheets/ | |
*/ | |
function onEdit(e) { | |
var oldValue; | |
var newValue; | |
var ss=SpreadsheetApp.getActiveSpreadsheet(); | |
var activeCell = ss.getActiveCell(); | |
if(activeCell.getColumn() == 3 && activeCell.getRow() >= 4 && ss.getSheetName != "Categorias" ) { | |
newValue=e.value; | |
oldValue=e.oldValue; | |
if(!e.value) { | |
activeCell.setValue(""); | |
} else { | |
if (!e.oldValue) { | |
activeCell.setValue(newValue); | |
} else { | |
activeCell.setValue(oldValue+'; '+newValue); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment