Results 1 to 6 of 6

Thread: Formula Vs FormulaR1C1 To Pass Calculation Range Through VBA

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    9
    Rep Power
    0
    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

  2. #2
    Junior Member
    Join Date
    Oct 2013
    Posts
    9
    Rep Power
    0
    Thanks for your response. I tried using your suggested solution which works now.

Similar Threads

  1. Replies: 2
    Last Post: 08-17-2013, 08:37 PM
  2. Replies: 7
    Last Post: 04-21-2013, 07:50 PM
  3. Formula Following Order Of Calculation BODMAS
    By paul_pearson in forum Excel Help
    Replies: 7
    Last Post: 03-27-2013, 02:07 PM
  4. VBA To Pass A Variable In An Excel Formula
    By devcon in forum Excel Help
    Replies: 4
    Last Post: 12-17-2012, 09:12 PM
  5. Replies: 11
    Last Post: 10-07-2012, 12:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •