P
P
PiShim2021-02-11 06:45:42
Google Apps Script
PiShim, 2021-02-11 06:45:42

How to make linked drop down lists in Google Sheets?

Please tell me how you can do it in the same interconnected drop-down lists, when you select the desired value in one drop-down list and it is also selected in the other list, and vice versa. Well, the same problem with checkboxes. That is, there is a list A and a list B. In list A, select the value 1, then in list B it appears and vice versa from B to A, but there are 10 such identical lists

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2021-02-11
@ProgrammerForever

You need to handle the onEdit() event, and you need to assign a full-fledged trigger to it.
Code snippet for onEdit ()

function onEdit(event) {
  //Возникает при изменении ячейки
  var ss = event.source.getActiveSheet();//Текущий лист
  	var address = event.range.getA1Notation().toUpperCase();//Адрес ячейки
  var row = event.range.getRow();							//Номер строки
  var col = event.range.getColumn();						//Номер столбца
  var newValue = event.value;								//Новое значение
  var oldValue = event.oldValue;							//Старое значение
  
  if (["Лист1","Лист2"].indexOf(ss.getName())==-1) return;	//Указываем на каких листах должен работать скрипт
  
  //Что-то делаем...
  };

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question