hi
I am using setSharedFormula to copy the formula to the other cells.
It is working fine when the formula uses the columns of same subsheet
ex : =E2+AP2
But when the formula Referencing Different Worksheet then setSharedFormula is not working.
One of the formula I am using is
=SUMIFS('sheet1'!H:H,'sheet1'!D:D,sheet2!$C$38,'sheet1'!G:G,sheet2!W)
Note : sheet2 is the current sheet.
My code is like below
for (int i = firstCellNumber; i <= targetCellNumber; i++) {
Cells parameterCells = currentWorkSheet.getCells();
Cell cell = parameterCells.get(1, cellNumber);
if (cell.getFormula() != null) {
cell.setSharedFormula(cell.getFormula(), parameterCells.getMaxDataRow(), 1);
}
}
Note : We found one workaround, If I define the formula in Name manager then it will work fine.
Could you please advise , how to use setSharedFormula when referencing different worksheet ?
-Thanks,
Santhosh.