I have a google spreadsheet and a randomly selected row is always shown in row 3:
A3:
=round(rand() * 808 + 1)
B3:
=VLOOKUP(A3;A8:B815;2)
When i click on a button, i want the formula to reload and also jump to that row, so i made a macro:
function Refresh() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A1').setValue("");
SpreadsheetApp.flush();
spreadsheet.getRange("A7").offset(spreadsheet.getRange('A3').getValue(),0).activate()
};
The reason, that i didnt put the calculation of random into the macro is, that i also want this random row in spreadsheets where macros are disabled (mobile + users who dont know).
When i run the macro, a new value is calculated in A3 (from flush) and then the corresponding row is activated. The issue is, that with the last row of the macro the value of A3 is recalculated because something changed and then the number does not match up anymore with the activated row.
Is there a way to block calculations? Or to scroll to the row without activating recalculations?