I partially know the name of 2 sheets I need to rename when the cell B2
change in each sheet:
One in called
csv_nat
and it should be renamed tocsv_nat_30_11_2019
when cellB2
in sheet changes (it is a date format like 30/11/2019)The other one has the exact same structure and is called
csv_alt
My main issue is the following. When the tab name has already changed, I need to locate the sheet from its root name (csv_nat
) and I have not figured out how.
My limited and starting code for now is:
function onEdit(e){
if(e.range.getA1Notation() != "B2") return;
e.source.getActiveSheet().setName("csv_nat_"+e.value);
}
Besides, does the onEdit
function work for any change or only when user edits the cell?
e.range.getSheet()
would be better), so why exactly do you need to locate the sheet by tab name? – Diego