Created
March 11, 2017 05:47
-
-
Save deathponta/d814d8accb0e931cf5602f05c3b4fcec to your computer and use it in GitHub Desktop.
GoogleSSで最終行を取得して移動する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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