Hi,
I'm trying to use VBA to put a formula in a cell which will average the values in the last 6 columns. The following works OK:
TableSheet.Cells(WorkingRow, LastColumn + 1).Select
ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-6]:RC[-1])"
(WorkingRow and LastColumn are integers) but I'd like to avoid selecting the target cell. If I try the following:
TableSheet.Cells(WorkingRow, LastColumn + 1).FormulaR1C1 = "=AVERAGE(RC[-6]:RC[-1]"
nothing is inserted in the target cell (I'm guessing because the relative references refer to the currently selected cell?)
Any suggestions gratefully recieved - thanks
I'm trying to use VBA to put a formula in a cell which will average the values in the last 6 columns. The following works OK:
TableSheet.Cells(WorkingRow, LastColumn + 1).Select
ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-6]:RC[-1])"
(WorkingRow and LastColumn are integers) but I'd like to avoid selecting the target cell. If I try the following:
TableSheet.Cells(WorkingRow, LastColumn + 1).FormulaR1C1 = "=AVERAGE(RC[-6]:RC[-1]"
nothing is inserted in the target cell (I'm guessing because the relative references refer to the currently selected cell?)
Any suggestions gratefully recieved - thanks