1st of all sorry for my poor english. trying to put with a macro a formula into a cell to find the corrispective value of 2nd column in row with "Banana" in first column with VLOOKUP.
simple spreadsheet with a module sheet linked
function searchBanana() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A5').activate();
spreadsheet.getCurrentCell().setFormula('=VLOOKUP("banana";fruit!A:D;2;FALSE)');
};
when I register the macro or I write the formula manually it works well, if I create the formula by macro I got error on formula (just on spreadsheet view, not in code view). If I copy-paste the formula generated by the macro into another cell it work.