public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB) {if( crB == null) {return crA.copy();}int minRow = lt(crB.getFirstRow(),   crA.getFirstRow())   ?crB.getFirstRow()   :crA.getFirstRow();int maxRow = gt(crB.getLastRow(),    crA.getLastRow())    ?crB.getLastRow()    :crA.getLastRow();int minCol = lt(crB.getFirstColumn(),crA.getFirstColumn())?crB.getFirstColumn():crA.getFirstColumn();int maxCol = gt(crB.getLastColumn(), crA.getLastColumn()) ?crB.getLastColumn() :crA.getLastColumn();return new CellRangeAddress(minRow, maxRow, minCol, maxCol);}

public static CellRangeAddress CreateEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB){if (crB == null){return crA.Copy();}returnnew CellRangeAddress(lt(crB.FirstRow, crA.FirstRow) ? crB.FirstRow : crA.FirstRow,gt(crB.LastRow, crA.LastRow) ? crB.LastRow : crA.LastRow,lt(crB.FirstColumn, crA.FirstColumn) ? crB.FirstColumn : crA.FirstColumn,gt(crB.LastColumn, crA.LastColumn) ? crB.LastColumn : crA.LastColumn);}
