Results 1 to 7 of 7

Copying array formula to last row using VBA.

Threaded View

  1. #1
    Registered User
    Join Date
    09-16-2010
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    68

    Copying array formula to last row using VBA.

    Hi all,

    I am using the following macro to copy an array formula from cell B2 down to the last row:

    Sub Copy_Array_Formula_Down_To_Last_Row()
    
    Application.ScreenUpdating = False
    
    Dim LastRow As Long
    
        With Sheets("SN Validity Check")
            LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
            Range("B2:B" & LastRow).FormulaArray = _
            "=INDEX('Master MICL'!AQ:AQ,MATCH($A2&""ACTIVE"",'Master MICL'!H:H&'Master MICL'!N:N,0))"
        End With
    
    Application.ScreenUpdating = True
    
    End Sub
    The formula is copied to the last row of column B, however the formula always refers to value $A2, i.e.
    - Cell B3 should contain formula:
    {=INDEX('Master MICL'!AQ:AQ,MATCH($A3&"ACTIVE",'Master MICL'!H:H&'Master MICL'!N:N,0))}
    - Cell B4 should contain formula:
    {=INDEX('Master MICL'!AQ:AQ,MATCH($A4&"ACTIVE",'Master MICL'!H:H&'Master MICL'!N:N,0))}
    But they all contain
    {=INDEX('Master MICL'!AQ:AQ,MATCH($A2"&"ACTIVE",'Master MICL'!H:H&'Master MICL'!N:N,0))}
    Any ideas anyone?

    Thanks.
    Last edited by Folshot; 11-24-2013 at 01:44 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copying an Array Formula
    By alxan2007 in forum Excel General
    Replies: 3
    Last Post: 10-26-2011, 08:10 PM
  2. Copying an array formula
    By geoffreynd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-13-2008, 04:25 PM
  3. Copying an Array
    By BDH in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-21-2006, 12:15 AM
  4. [SOLVED] Tricky array formula issue - Using array formula on one cell, then autofilling down a range
    By aspenbordr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2005, 11:05 AM
  5. Copying an Array Formula
    By montagu in forum Excel General
    Replies: 1
    Last Post: 07-15-2005, 02:30 PM

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