Reference another sheet in Formula string SpreadSheetGear
-
14-07-2021 - |
Question
As the questions states, I'm trying to reference some cells from one sheet to another. In one sheet I have the Data to populate some other cells in my Principal sheet
In short: DataSheet > Feeds > PrincipalSheet
I'm trying something like:
"=Data!$A$1"
I've even tried something like:
"=[Book1]Data!$A$1"
But still, I can't find the correct code.
I have SpreadSheetGeat 2010 and using C#
Thanks in advance for the help you provide!!
Solution
Find the answer, actually, the formula is OK, I was generating the cell ranges with some manual, over the top code, and all that I needed was to put
MySheet.Cells[add ranges here].Range.ToString();
With this code, SpreadSheet generates automatically in which range you are on in this format : "=[Book1]Data!$A$1", and is based on the range that you put in .Cells[],
OTHER TIPS
For some reason Spreadsheet gear adds "[Book1]" when I try the following code. It didn't seem to work in excel.
MySheet.Cells[add ranges here].Range.ToString();
So I manually set the formula Like so:
cells[ rowIndex, 2 ].Formula = "=IFERROR('MySheet1'!$E$6,0)";