dimanche 3 mai 2020

leave cell unchanged if condition is not met

I need a function that will allow to recopy what is already written in a cell. I'd call it NothingHasChanged() and i'd use this way:

In a cell choosed randomly i'd type:
if(A1="Yes"; "The cell A1 contained Yes at least once"; NothingHasChanged() )

This way i'd keep history of the cell value overtime.

I tried to do a script :

function FormulaToValueV2() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getCurrentCell().offset(599, 0).activate();
  spreadsheet.getCurrentCell().offset(-599, 0).copyTo(spreadsheet.getActiveRange(), 
SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
  spreadsheet.getCurrentCell().offset(-599, 0).activate();
  spreadsheet.getCurrentCell().offset(599, 0).copyTo(spreadsheet.getActiveRange(), 
SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
};

that i generated from a macro i did by copying as a value to override the formula but it throws me an error saying that i don't have the permission to "copyto".

I'm desesperate actually, i'm not a programmer

Thanks for the help and stay safe

Aucun commentaire:

Enregistrer un commentaire