+ Reply to Thread
Results 1 to 4 of 4

Using a table column in VBA code

  1. #1
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Using a table column in VBA code

    I have a table that, when data is added to it, expands the number of rows to accommodate the size of the data. In Column G is a formula that references Column E. If I change the formula in the first cell of the column, that formula is copied down correctly and when adding rows this formula is properly added to the new rows but I also allow this column to be edited if needed which, of course, removes the formula.

    So I have created a macro that can be executed to reset the formulas in that column back to the starting point. Initially, my VBA code was written to upgrade each of the initial rows but if I add rows, this code stops at the last original row. So, the question is, can I use the table name/column name in a VBA formula so that I can use one line of VBA code that correctly resets the formulas in all rows, new and old?

    The formula is: =IF(E17="""","""",$AV$35)
    The Table name/Column name is: UnitData[Floorplan Data]

    In the data above, E17 should increment to E18, etc.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Using a table column in VBA code

    Try something like this...

    Please Login or Register  to view this content.

    The VBA Guide To ListObject Excel Tables
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Using a table column in VBA code

    Works great!

    Thank you...

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Using a table column in VBA code

    You're welcome. Thanks for the feedback.

+ 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. VBA code for grouping table column variable to collapse/expand?
    By xdrenched in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2016, 10:48 AM
  2. VBA Code for Userform to Alter Values in Table Column
    By Krisofa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2015, 05:08 PM
  3. What is slow about my code? Recordset to update table column
    By Broker15 in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2014, 11:26 AM
  4. Replies: 3
    Last Post: 06-04-2013, 01:00 PM
  5. vba code to filter pivot table column labels based on cell vaule
    By nailler167 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-31-2013, 09:12 PM
  6. Replies: 11
    Last Post: 03-04-2013, 12:57 PM
  7. [SOLVED] Trying to add a calculated column to an existing pivot table code
    By dwhite30518 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 05-14-2012, 02:34 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