This project has moved. For the latest updates, please go here.

Formula to reference a cell in another worksheet

Dec 17, 2010 at 11:28 PM

I am trying to add in a formula to display the contents of a cell from another worksheet.  I have a worksheet called Accounts, and I'm trying to reference it.  However, whenever I try to open my excel doc, it gives the error that there was an error in doc, and it tries to repair it.  It ends up removing the formula.  This is how I'm trying to set it:

summaryWS.Cells[iRowT, 8].FormulaR1C1 = "Account!r8c8";

I've tried both using FormulaR1C1 and Formula.  I'm guessing that I'm just doing something wrong here....  thanks!

- Dave

Dec 20, 2010 at 7:54 AM


This i a bug in the r1c1 parsing. I'll add a fix for that.

Use this as an alternative.

summaryWS.Cells[iRowT, 8].Formula = string.Format("Account!{0}", ExcelCellBase.GetAddress(8,8));