putting data manually into a formula cell

Posted by: hpd71 on 8 September 2017, 1:31 pm EST

  • Posted 8 September 2017, 1:31 pm EST


    I have a grid, where I have the last col as a total col, I do this with the command below.

    The problem is that I want that for all rows (could be 100's) but for the last 2 rows which are added to the grid with .rowcount += 7 (seven non bound rows added, only the last two are not to be total cols) the rest of the grid is bound to a dataset.

    I am unable to set the cells value for those last two rows as they are working as formula.

    How can I either remove the formula, just for those last two rows(leaving it in place for all other rows) or somehow set the value of those cells to a value I want to have.



    FpSpread1.ActiveSheet.Columns(FpSpread1.ActiveSheet.ColumnCount - 1).Formula = "SUM(e1:" & FpSpread1.ActiveSheet.GetColumnAutoText(FpSpread1.ActiveSheet.ColumnCount - 2) & "1)"

  • Replied 8 September 2017, 1:31 pm EST

    You should be able to just set the value to the cells.  If that doesn't work then assign the formula to the cells you want it in instead of the entire column.
  • Replied 8 September 2017, 1:31 pm EST


    In addition to what Bob stated, you can assign the formula to individual cells to begin with instead of the entire column.

    FpSpread1.ActiveSheet.Cells(0, FpSpread1.ActiveSheet.ColumnCount - 1, FpSpread1.ActiveSheet.RowCount - 3, FpSpread1.ActiveSheet.ColumnCount - 1).Formula = "SUM(e1:" & FpSpread1.ActiveSheet.GetColumnAutoText(FpSpread1.ActiveSheet.ColumnCount - 2) & "1)"

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels