Reputation: 523
How to know the last row of a merged cell, like for example
In the above sheet if somebody edits range A2 containing value a
, onEdit()
method will be triggered. I can get to know the row and column of the edited cell using range.getRow()
and range.getColumn()
like this
function onEdit(e){
var range = e.range;
var Row = range.getRow();
var Col = range.getColumn();
}
How to know the last row of a merged cell like for a
it is 10
, for b
it is 12
, for c
it is 20
, for one
it is 7
and so on using Apps script?
Upvotes: 1
Views: 1474
Reputation: 8606
If the edited cell is part of a merged cell you can use this.
if( e.range.isPartOfMerge() ) {
var range = e.range.getMergedRanges()[0];
var lastRow = range.getLastRow();
}
else {
// You figure it out
}
Upvotes: 3