I'm trying to set a cell's formula as such:

 

D10 * Shared Metrics!UIRpgJava

 

What I'm trying to do with this formula is multiply the value of D10 by
the value of a cell, on the "Shared Metrics" sheet within the same
workbook, named "UIRpgJava".

 

 

Here's the code and error I get (these are just the relevant code
extracts):

 

      cell = row.createCell((short)5);

      cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);

 

      String uiSubTotalFormula = null;

      try

      {

uiSubTotalFormula =
DecompEstimateFormulas.getUISubTotalFormula(currentRowIndex);

cell.setCellFormula(uiSubTotalFormula);

      }

      catch (Exception e)

      {

log.error("Encountered error while attempting to set the UI SubTotal
formula for row " + 

currentRowIndex + ", module [" + uiModuleName + "].  Formula: [" +
uiSubTotalFormula 

+ "].  Error: " + e.getMessage()); 

      }

 

 

      public class DecompEstimateFormulas

      {

 

            public static final String UI_SUBTOTAL_FORUMLA =

                  "(D{::RowIndex::} * 'Shared Metrics!UIRpgJava')";

 

 

            public static String getUISubTotalFormula(int rowIndex)

            {

                  String formula =
StringUtils.replace(UI_SUBTOTAL_FORUMLA, "{::RowIndex::}",
String.valueOf(rowIndex + 1));

 

                  return formula;

            }

      }

 

[Friday, September 28, 2007 - 14:20:58:765 EDT]  ERROR:
Encountered error while attempting to set the UI SubTotal formula for
row 14, module [EDPEMLCLNT].  Formula: [(D15 * 'Shared
Metrics!UIRpgJava')].  Error: Invalid Formula cell reference: 'SHARED
METRICS!UIRPGJAVA'

 

 

Just in case, I also tried the formula with quotes around my named cell.
This yields the same outcome.

 

Eric A. Gravel
Senior Java Programmer/Analyst
Internet Development, Application Services, I.T.

Interval International
6262 Sunset Drive, PH-1
Miami, FL, 33143
Office: (305) 666-1861 x7315
Fax:    (305) 668-3409
Email:  [EMAIL PROTECTED]

http://www.intervalworld.com
http://friendsandfamily.condodirect.com/web/cs?a=5&clubCode=interval
http://www.liveitup.com

 


_____________________________________________________________________________
Scanned by IBM Email Security Management Services powered by MessageLabs. For 
more information please visit http://www.ers.ibm.com
_____________________________________________________________________________

Reply via email to