+ Reply to Thread
Results 1 to 5 of 5

VBA FormulaArray

Hybrid View

  1. #1
    Registered User
    Join Date
    03-21-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    90

    VBA FormulaArray

    Hi,

    I keep getting an error when I use this code. The formula is matching the ActiveWorksheet cells to a file name Current.xls and pulling the answer/data from the Current.xls. The formula works fine by just doing the array in the excel file but when I try to automate it using VBA code I get an error message saying "Unable to set FormulaArray property of the Range class".

    Here is the code:
    Range ("C62").FormulaArray = "=INDEX('[Current .XLS]qry_BFFinal'!$A$2:$G$786,(MATCH(B2&B62&(B9+1),'[Current.XLS]qry_BFFinal'!$A$2:$A$786&'[Current.XLS]qry_BFFinal'!$C$2:$C$786&'[Current.XLS]qry_BFFinal'!$F$2:$F$786,0)),7)"

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA FormulaArray

    I think it has to be done using R1C1 style references for the cells.

    As an example (from the vba help documentation):
    Worksheets("Sheet1").Range("E1:E3").FormulaArray = _
        "=Sum(R1C1:R3C3)"
    You might be able to get around it doing something like
    Range("C62")="=INDEX('[Current .XLS]qry_BFFinal'!$A$2:$G$786,(MATCH(B2&B62&(B9+1),'[Current.XLS]qry_BFFinal'!$A$2:$A$786&'[Current.XLS]qry_BFFinal'!$C$2:$C$786&'[Current.XLS]qry_BFFinal'!$F$2:$F$786,0)),7)" 
    Range("C62").formulaarray = Range("C62").formular1c1
    Last edited by ragulduy; 09-19-2013 at 11:25 AM.

  3. #3
    Registered User
    Join Date
    03-21-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    90

    Re: VBA FormulaArray

    yudlugar thanks for the help but that did not work.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA FormulaArray

    You probably need to rewrite it as an r1c1 formula then.

  5. #5
    Registered User
    Join Date
    03-21-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    90

    Re: VBA FormulaArray

    Ok thanks. I think I will just use vlookups. I've never used FormulaArrays so the R1C1 maybe over my head. But thanks again for your help.

+ 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. [SOLVED] FormulaArray
    By GreyBates in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2013, 04:56 PM
  2. FormulaArray
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2011, 06:32 PM
  3. DDE and FormulaArray problem
    By tlinetrader in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2009, 12:54 PM
  4. Using FormulaArray in VBA
    By marcelobf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2006, 04:50 PM
  5. [SOLVED] Copy FormulaArray
    By Len in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-18-2005, 08:06 AM

Tags for this Thread

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