+ Reply to Thread
Results 1 to 3 of 3

Named Ranges

  1. #1
    Registered User
    Join Date
    08-22-2006
    Location
    Derbyshire
    Posts
    15

    Named Ranges

    I am trying to use VB to enter TREND functions into my worksheet. This works OK if I use code similar to the following,

    ActiveSheet.Range(Cells(7, 9), Cells(7, 13)).Select
    Selection.FormulaArray = _
    "=TREND(R[-4]C[-7]:R[-4]C[-1],R[-6]C[-7]:R[-6]C[-1],R[-6]C:R[-6]C[4])"

    or
    Range("L26:P26").Select
    Selection.FormulaArray = "=TREND(TestRange1,Testrange2,TestRange3)"


    but I want to be able to change the ranges as required.
    Q1.. Can I use variables in these lines or
    Q2.. Can I create Named Ranges using variables.

    Thanks in anticipation

  2. #2
    Peter T
    Guest

    Re: Named Ranges

    sFormula = "=TREND(" & sAddr1 & "," & sAddr2 & "," & sAddr3 & ")"

    ActiveSheet.Range(Cells(7, 9), Cells(7, 13)).FormulaArray = sFormula

    Regards,
    Peter T

    "Guitar Billy" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I am trying to use VB to enter TREND functions into my worksheet. This
    > works OK if I use code similar to the following,
    >
    > ActiveSheet.Range(Cells(7, 9), Cells(7, 13)).Select
    > Selection.FormulaArray = _
    >
    > "=TREND(R[-4]C[-7]:R[-4]C[-1],R[-6]C[-7]:R[-6]C[-1],R[-6]C:R[-6]C[4])"
    >
    > or
    > Range("L26:P26").Select
    > Selection.FormulaArray =
    > "=TREND(TestRange1,Testrange2,TestRange3)"
    >
    >
    > but I want to be able to change the ranges as required.
    > Q1.. Can I use variables in these lines or
    > Q2.. Can I create Named Ranges using variables.
    >
    > Thanks in anticipation
    >
    >
    > --
    > Guitar Billy
    > ------------------------------------------------------------------------
    > Guitar Billy's Profile:

    http://www.excelforum.com/member.php...o&userid=37859
    > View this thread: http://www.excelforum.com/showthread...hreadid=574104
    >




  3. #3
    Registered User
    Join Date
    08-22-2006
    Location
    Derbyshire
    Posts
    15

    Named Ranges

    Just the job! Works a treat.
    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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