User1909955381 posted
I'm create an excel spreadsheet dynamically using Excel Interop.
I have two cells in a single column.
The first cell contains this formula: "=(F1+G1)"
I would like to set the formula for the second cell to be the same as the first cell, but have F2 and G2 instead of F1 and G1. This needs to be dynamic.
Here's what I have now:
Excel.Range rngCurrentCell = (Excel.Range)ws.Cells[row,col];
Excel.Range rngPrevRow = (Excel.Range)ws.Cells[row - 1, col];
rngCurrentCell.Formula = rngPrevRow.Formula;
I thought the code above would work, but that just sets the second cell to have the formula: "=(F1+G1"