Free Support Forum -

Specifying a cell range on a different worksheet

I am working for a company that is currently evaluating whether to use Aspose.Excel in the system we are developing. So far the component has been terrific. We do have one problem though.

Sometimes we want to have formulas on one Excel worksheet reference a cell range on another worksheet. For example,


where Advertising is the name of a worksheet other than the worksheet that contains the above formula.

The problem is that Aspose.Excel rejects this as an invalid formula. Am I doing something wrong? If this is not yet implemented could you please add support for it?

Thanks in advance.

P.S. While I am here posting, is there any way to alias a cell to a name? The same as if you entered text into the ‘name box’ in the upper left corner of Excel where it usually shows the cell coordinates. Thanks Again!

Hi, thanks for your consideration.

Aspose.Excel support the feature you requested.
In your case, if you haven’t create a worksheet named “Advertising”, Aspose.Excel will reject your formula. So you should create the worksheet in your designer file or using API.

For example:

Excel excel = new Excel();
int index = excel.Worksheets.Add();
excel.Worksheets[index].Name = “Advertising”;
Cells cells = excel.Worksheets[0].Cells;
cells[“A1”].Formula = “=SUM(Advertising!C2:C5)”;

You can use Cells.CreateRange to create a Range object, then using Range.Name to set the alias. For example:

Range range = cells.CreateRange(“A5”, “A5”);
range.Name = “test”;