Skip to content

Instantly share code, notes, and snippets.

@deathponta
Created March 11, 2017 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deathponta/d814d8accb0e931cf5602f05c3b4fcec to your computer and use it in GitHub Desktop.
Save deathponta/d814d8accb0e931cf5602f05c3b4fcec to your computer and use it in GitHub Desktop.
GoogleSSで最終行を取得して移動する
function GoLastRow() {
var as = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastRow = as.getLastRow();
// 意味 A1 ~ A最終行 迄の範囲取得
var A_Cells = as.getRange( 1,1,lastRow,1 );
// Aのすべてのセル内の値配列
var A_Values = A_Cells.getValues();
// 上記配列のケツから順に値が入っているかをチェックして入っていたらそのセルをアクティベート
for( var i=A_Values.length-1; i>=1; i-- ){
if( A_Values[i] != "" ){
as.getRange(i+1, 1).activate();
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment