+ Reply to Thread
Results 1 to 3 of 3

VBA Array formula for dynamic ranges

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    VBA Array formula for dynamic ranges

    Hi all, I am trying to make a vba that would apply a array formula to a dynamic range.

    In specific I am declaring two dynamic ranges so as to loop to the diffrent sheets and also a LastRow variable that takes the number of rows.

    My desired formula is a trendline order 4

    Please see my code

    Set Selection1 = ActiveSheet.Range("J2:J" & LastRow)
    Set Selection2 = ActiveSheet.Range("K2:K" & LastRow)


    Range("N3:R3").Select
    Selection.FormulaArray = "=LINEST({Selection1},{Selection2}^{1,2,3,4})"



    Thank u all in advance!!

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA Array formula for dynamic ranges

    Rather than using range objects, use their address:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    03-25-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: VBA Array formula for dynamic ranges

    Quote Originally Posted by romperstomper View Post
    Rather than using range objects, use their address:
    Please Login or Register  to view this content.
    You sometimes just need a fresh eye to resolve sth...

    Thanks a lot mate!!!!

+ 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