code to explanationWed, 18 Jan 2023

function onEdit(e) { var sheet = e.source.getActiveSheet(); if (sheet.getName() == 'Sheet1' && e.range.getColumn() == 1) { var selection = e.range.getValue(); if (selection == 'Selecione uma opção') { var cellToChange = sheet.getRange(e.range.getRow(), e.range.getColumn() - 1); cellToChange.setValue('peticionar'); } } }

The function onEdit is run automatically whenever a cell is edited. The script checks if the sheet name is Sheet1 and the column is column A. It then gets the current selection and if it is "Selecione uma opção", it deletes the content in the cell one column to the left.

Questions about programming?Chat with your personal AI assistant