Hi there,
Running the code :-
function onEdit(event) {
SpreadsheetApp.getActiveSheet().getRange("A2").setValue(lastValue("B"));
}
function lastValue(column) {
var ss = SpreadsheetApp.getActiveSheet();
var lastRow = ss.getLastRow();
var values = SpreadsheetApp.getActiveSheet().getRange(column + "2:" + column
+ lastRow).getValues();
for (; values[lastRow - 1][0] == "" && lastRow > 0; lastRow--) {}
return values[lastRow - 1][0];
}
produces :-
TypeError: Cannot read property "0" from undefined.
Any ideas anyone?
thanks in anticipation,
Allan