Thanks for your response. I tried using your suggested solution by trying out the following test procedure. After the "InsertMetricsTable" procedure call, the debug.print is printing the correct sum formula which is "=SUM(R[-B11]C,R[-B14]C,R[-B17]C,R[-B20]C,R[-B23]C,R[-B26]C,R[-B29]C,R[-B32]C,R[-B35]C,R[-B38]C)" but when I am trying to assign it to the range formulaR1C1, I get an error saying: Run-time 1004: Application-defined or object-defined error. I am not sure what's wrong now!
Code:Application.ScreenUpdating = False Set oMetrics = ActiveSheet Call InsertMetricsTables sForMetricsTotalLineFormula = "=SUM(" & Mid(sForMetricsTotalLineFormula, 2) & ")" Debug.Print "After = " & sForMetricsTotalLineFormula Range("B39:D39").FormulaR1C1 = sForMetricsTotalLineFormula Application.ScreenUpdating = True




Reply With Quote
Bookmarks