Determining the last row in a single column

前端 未结 19 1524
野性不改
野性不改 2020-11-22 10:46

I have a sheet with data in cols A through H.

I need to determine the last row in column A that contains data (it\'s all conti

19条回答
  •  耶瑟儿~
    2020-11-22 11:07

    I realise this is quite an old thread but it's one of the first results when searching for this problem.

    There's a simple solution to this which afaik has always been available... This is also the "recommended" way of doing the same task in VBA.

    var lastCell = mySheet.getRange(mySheet.getLastRow(),1).getNextDataCell(
      SpreadsheetApp.Direction.UP
    );
    

    This will return the last full cell in the column you specify in getRange(row,column), remember to add 1 to this if you want to use the first empty row.

提交回复
热议问题