+ Reply to Thread
Results 1 to 2 of 2

Formula Array with a variable range

  1. #1
    Registered User
    Join Date
    10-01-2013
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Formula Array with a variable range

    Hello,

    I need help. I am using a built in function within a sub. "LastLineI" and "LastLineInterData" are a variable number within the code.

    OutSheet.Range(OutSheet.Cells(1, 4), Cells(LastLineInterData, 7)).FormulaArray = _
    "=SplineData(Cells(3,1):cells(LastLineI,2), Cells(1,3):Cells(LastLineInterData,3))"

    When I run the code it puts out "#VALUE!" in all the cells. When I record the routine I was able to get another format to use, which works within my code. It is:

    OutSheet.Range(OutSheet.Cells(1, 4), Cells(LastLineInterData, 7)).FormulaArray = _
    "=SplineData(R[2]C[-3]:R[22]C[-2],RC[-1]:R[300]C[-1])"

    But I need to be able to use the variables for my code. I have tried about anything and everything to get it to work. What am I missing?

  2. #2
    Registered User
    Join Date
    10-01-2013
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Formula Array with a variable range

    Got it! After hours of searching it came out to be quite simple.

    OutSheet.Range(OutSheet.Cells(1, 4), OutSheet.Cells(LastLineInterData, 7)).FormulaArray = _
    "=SplineData(R[2]C[-3]:R[" & LastLineI - 1 & "]C[-2],RC[-1]:R[" & LastLineInterData - 1 & "]C[-1])"

    To use a numeric variable in the R1C1 notation for the FormulaArray, you must include the " & VAR & " to force the expression.

    Thanks anyways.

+ 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. vlookup with variable range and variable array size
    By chaslie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2013, 02:37 PM
  2. [SOLVED] Help: Defining a variable with an array of worksheets that use the same range
    By paulw793 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 03:34 PM
  3. Referencing a variable in an array range
    By ChainsawDR in forum Excel General
    Replies: 3
    Last Post: 01-09-2012, 09:22 AM
  4. Using array variable to populate range
    By sweep in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-19-2008, 11:14 AM
  5. Set array= range, and using a variable name for a worksheet
    By Keruck in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2008, 11:55 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