+ Reply to Thread
Results 1 to 3 of 3

Issue with formula within VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    09-08-2008
    Location
    London
    Posts
    40

    Issue with formula within VBA

    Hi,

    I have added the below code to a file and it isn't quite working for some reason. Can anyone help?

    Once the macro has run, the formula entered looks like this in the relevant cell in Excel, if there isn't a set of brackets around the last x then the formula would work fine but i can determine why the brackets are appearing:-

    =SUM(CUST_AR001:CUST_ZA009!G:g)/2-SUM('Raw data'!x: (x))

    The code I have used is as follows:

    Sheets("run macro").Select
    Range("b13").Select
    ActiveCell.FormulaR1C1 = _
    "=SUM(CUST_AR001:CUST_ZA009!G:G)/2-SUM('Raw data'!X:X)"
    Range("b13").Select


    Thanks,
    McQLon

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Issue with formula within VBA

    You should be using Formula and not FormulaR1C1 since you are are not using R1C1 addressing
    ActiveCell.Formula = "=SUM('CUST_AR001:CUST_ZA009'!G:G)/2-SUM('Raw data'!X:X)"
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    09-08-2008
    Location
    London
    Posts
    40

    Re: Issue with formula within VBA

    Excellent, thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. M formula issue
    By djl295 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-02-2017, 04:29 AM
  2. [SOLVED] Index Match Formula Issue - Lookup Value is a Formula
    By dodgemain in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2016, 11:48 AM
  3. [SOLVED] Formula issue
    By Peterino in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-27-2014, 02:42 PM
  4. [SOLVED] IF/ELSE formula with OR/AND issue
    By Doofus1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2014, 11:45 PM
  5. Lookup Formula Issue, Search issue
    By kperitz in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-07-2014, 01:50 PM
  6. Old Formula Issue
    By buffalochaser in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 01:33 PM
  7. Excel 2007 : Formula issue
    By Cypher2301 in forum Excel General
    Replies: 2
    Last Post: 07-06-2012, 07:59 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1