All, Imagine a google sheet with many columns, and every column has a different filled row, and imagine that we wanted the sheet load on the last filled row of a specific column.
I am using the following function to make google Sheets view the last row of column “C" upon loading. Yet, upon loading, I found the sheat focus on the last row of the first column rather than the last row of column “C". This function is working fine based on the first column.
function onOpen() {
var column = "c"
let ss = SpreadsheetApp.getActiveSheet();
let lastRow = ss.getMaxRows();
ss.setActiveRange(ss.getRange(column + lastRow));
}
I tried these steps in this post stackoverflow but without success.
———————
Based on the solution below, here is the updated onOpen function.
function onOpen() {
let ss = SpreadsheetApp.getActiveSheet();
let lastRow = ss.getLastRow();
mycol=getColumnHeight(3)
//Browser.msgBox(mycol)
ss.setActiveRange(ss.getRange(mycol,1));
}