+ Reply to Thread
Results 1 to 5 of 5

VBA to Insert 21 Table Rows; Format as Below

  1. #1
    Registered User
    Join Date
    05-07-2014
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Question VBA to Insert 21 Table Rows; Format as Below

    Hello all,

    I've been doing a lot of searching on this topic, as not to bog down the forum, but I just can't find the right code. I'm very new to VBA.

    I have simple table that I would like to insert 21 rows to it when the user clicks a command button (I know how to assign code to a button).

    The number of rows will always be 21, and, will always be inserted at the first row of the table (ie, Table Rows Above) . When the 21 rows have been inserted, the formulas in the previous 1-21 rows should auto fill into the new set of 21 rows.

    I tried using the macro recorder to do this, but it doesn't seem to work. When searching for VBA code, it seams most of the answers only insert 1 row at a time. Some of the answers refer to looping in order to get to 'n' rows.

    Can multiple rows be added to a table object at once with VBA, or does it require a loop? Is there a link to this code?

    Thank you!
    -Rich

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA to Insert 21 Table Rows; Format as Below

    As people use table meaning interchangeably and the syntax required in VBA will differ depending on your definition of table

    are you using a "table" table or just using formatting to make it look like a table?

    ps this is what i mean by "Table"
    https://www.excel-easy.com/data-analysis/tables.html
    Last edited by humdingaling; 05-24-2018 at 08:19 PM.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    05-07-2014
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: VBA to Insert 21 Table Rows; Format as Below

    My apologies. A created/inserted table, as described in your link, and named "AFG".

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA to Insert 21 Table Rows; Format as Below

    that makes things slightly easier

    adapted from
    https://www.thespreadsheetguru.com/b...t-excel-tables

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-07-2014
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: VBA to Insert 21 Table Rows; Format as Below

    Solved. Thank you kindly!

+ 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. Insert rows in linked table that are added to secondary table
    By Ida LaValley in forum Excel General
    Replies: 4
    Last Post: 11-16-2020, 12:00 PM
  2. Table that insert measures and insert blank rows
    By searme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2016, 04:49 AM
  3. Insert Rows and copy format and formula
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2015, 08:00 AM
  4. insert or format a table
    By VKeel in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2013, 07:57 AM
  5. Replies: 0
    Last Post: 05-10-2013, 12:04 PM
  6. Find Text, Offset, Insert and Format Rows
    By NicholeMW in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2012, 06:53 AM
  7. Keep format of data table after insert a new row on a protected sheet
    By RickyC in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2010, 10:58 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