+ Reply to Thread
Results 1 to 2 of 2

Adding another column to existing table with array formula

  1. #1
    Registered User
    Join Date
    05-27-2016
    Location
    chicago,Usa
    MS-Off Ver
    2013
    Posts
    18

    Adding another column to existing table with array formula

    Range("J2").Select
    ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
    False
    Selection.FormulaArray = _
    "=MIN(IF([Serial Number]=[@[Serial Number]],IF(NOT(ISBLANK([Service Date])),[Service Date],FALSE)))"
    Range("J2:J142").FormulaArray = _
    "=MIN(IF(Table1[Serial Number]=Table1[@[Serial Number]],IF(NOT(ISBLANK(Table1[Service Date])),Table1[Service Date],FALSE)))"
    ActiveWindow.SmallScroll Down:=-27
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "Min Day"

    This is the macro recorded when the action is preformed. I want to modify this so that it works for table of all sizes. I tried using the code below but it says that "x1Down" is not defined. Any advice?

    Dim example As Range
    Set example = Range(Range("I2"), Range("I2").End(x1Down))
    example.Offset(0, 1).Select
    Selection.FormulaArray = _
    "=MIN(IF([Serial Number]=[@[Serial Number]],IF(NOT(ISBLANK([Service Date])),[Service Date],FALSE)))"
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "Min Day"
    Last edited by eliasc; 06-08-2016 at 09:01 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Adding another column to existing table with array formula

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ 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. Replies: 0
    Last Post: 01-27-2016, 11:19 AM
  2. Replies: 3
    Last Post: 01-13-2016, 12:05 PM
  3. [SOLVED] Copying a Formula Down a Column in an Existing Table
    By MausDef in forum Excel General
    Replies: 6
    Last Post: 11-19-2015, 04:19 PM
  4. Adding a formula column based on the pivot table's Grand Total column
    By trisoldee in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-26-2014, 05:29 PM
  5. [SOLVED] Adding to a new variable array from an existing array
    By Aussiexile in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-17-2014, 12:08 AM
  6. [SOLVED] Automatically Adding a IF Statement To A Column Of Existing Formula's
    By GEANZ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-12-2013, 12:50 AM
  7. adding data with formula to existing table in ms access
    By nataliem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2007, 03:46 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