+ Reply to Thread
Results 1 to 2 of 2

Array Populating Table with Formulas; Excel Automatically adding @ Before Table Name

  1. #1
    Registered User
    Join Date
    01-18-2021
    Location
    california, united states
    MS-Off Ver
    MS365 (PC) Version 2209
    Posts
    39

    Array Populating Table with Formulas; Excel Automatically adding @ Before Table Name

    Hi All,

    I'm writing a macro that is populating an array with values, some of which are formulas that include table references. The array is then pasting those values/formulas into a destination table. The destination table is based on a source table template that has the formulas populated in cells without the "=" at the beginning as the formulas include lookups referring to other tables in the source template workbook. The source template table and lookup tables are copied into a new workbook so it is necessary the formulas aren't "live" when this happens as these formulas would refer to the source workbook's lookup tables rather than the destination workbook's lookup tables. As the array reads these "formulas", it adds a "=" to the beginning of it to make it live. The array is pasted into the destination workbook's table once it is fully populated, and the formulas are now live in the destination workbook and are referring to the destination workbook's lookup tables.

    The issue is that once the array is pasted into the destination table, the formulas' table references are being appended by an "@", causing the entire formula to give a #VALUE error. I have seen people use .Range("A1").Formula2R1C1 when pasting an individual formula, but I am pasting the entire array into the table at one time.

    For example, cell A2 in the source workbook's Table1 will contain a "formula":

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The formula itself is not important, hopefully you get the idea - there are references to Table1 and Lookup in it. The macro reads the "formula" into the array and appends it with a "=" (along with a bunch of other hard-coded values that are read as-is).

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Once the array has been populated, it is pasted into the destination workbook's table.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For some reason, the Table1 references are now appended with an "@".

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Is there any way to prevent this from happening when pasting the array into the table? Or is there some other workaround I can do to prevent this?

  2. #2
    Registered User
    Join Date
    01-18-2021
    Location
    california, united states
    MS-Off Ver
    MS365 (PC) Version 2209
    Posts
    39

    Re: Array Populating Table with Formulas; Excel Automatically adding @ Before Table Name

    So what I ended up doing to solve this issue was convert the SMALL and LARGE portions of these formulas to AGGREGATE formulas and the issue was resolved. I don't know how I would have fixed this otherwise.

+ 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. Updating array formulas in the table automatically
    By sepehr485 in forum Excel General
    Replies: 3
    Last Post: 11-27-2022, 07:08 AM
  2. How to adding from multiple queries or DSN automatically into one table excel
    By roykana in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-31-2019, 12:28 PM
  3. [SOLVED] Populating 2 columns of table from array
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2019, 04:51 AM
  4. Replies: 3
    Last Post: 07-12-2017, 04:44 AM
  5. Adding new formulated row to Excel table automatically
    By sparrow76 in forum Excel General
    Replies: 7
    Last Post: 04-02-2015, 09:41 AM
  6. [SOLVED] Adding Record to data table + preserve array formulas in specific columns
    By olivierpbeland in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2013, 02:33 PM
  7. adding images to excel table automatically
    By Grafula in forum Excel General
    Replies: 1
    Last Post: 03-14-2006, 04:33 AM

Tags for this Thread

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