Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I am using Excel interop services to generate an excel sheet from c#. I have worked out all the details except one, I want one column at the far end of the sheet to dynamically calculate the previous excel sheet cells.

I have used the formula setting of excel cells for this, using the following,

C#
Excel.Range.Formula="=A1-B1"


Till this point everything is fine.
Now, to work this formula for an entire column, I am using the functionality of

Excel.Range.EntireColumn

however, I want the calculation or the value to be fed from the third row, I tried the following.


C#
Excel.Range rng1 = (Excel.Range)osheet4.Cells[3, colCount + 2];
           Excel.Range newColumn1 = rng1.EntireColumn;


but it seems, it still starts at the first row, however, the column is coming fine.

Is there something, I am missing here? What is it that I am doing wrong?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900