+ Reply to Thread
Results 1 to 7 of 7

Macro to insert new row at the end of a table

  1. #1
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Macro to insert new row at the end of a table

    Hi Guys

    Any help with this will be much appreciated. I've created a table, however I want to control it as much as possible with the features below:

    1. I want a macro to insert a new row if users want to add a new line of data.
    2. I want the formulas in the greyed cells to be copied down when a new row is inserted, example is the last row in the table.
    3. I want the greyed cells only to be protected with a password


    Many thanks
    Attached Files Attached Files

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Macro to insert new row at the end of a table

    1. If you convert your "table" into a real table (Insert->Table), you simply start entering data below the first row and it becomes part of the table.
    2. If it's a table the formulas automatically expand to the new row.
    3. Protection is tricky when tables are involved - I'll pass on this one.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert new row at the end of a table

    Hi Fred,

    I put this code in a module:

    Please Login or Register  to view this content.
    And assigned it to your rectangle

    Here's the now macro-enabled book:
    Attached Files Attached Files
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Macro to insert new row at the end of a table

    Awesome xladept. Thank you very much. Please can you amend the script to copy down the formula in column A as well.

    Muchas gracias !!!
    Attached Files Attached Files

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert new row at the end of a table

    Hi Fred,

    Here's an amendment:

    Please Login or Register  to view this content.
    De Nada - you're welcome and thanks for the rep!

  6. #6
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Macro to insert new row at the end of a table

    Hi xladept, I tried to protect the cells which have the formula and the macro couldn't run successfully- is there a reason why its so?

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert new row at the end of a table

    Well, the program writes in those cells - so, if they're protected the program can't run.

    Try not protecting the column A formulas since they're entered by the program.
    Last edited by xladept; 11-19-2017 at 06:11 PM.

+ 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. [SOLVED] macro to automatically insert table in excel
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2013, 03:37 AM
  2. Macro to insert new VLOOKUP table entry
    By eb710 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2013, 10:46 AM
  3. macro to insert data table
    By a2424 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2012, 11:27 PM
  4. Insert a name to a table via a macro
    By h.maleki in forum Excel General
    Replies: 5
    Last Post: 04-26-2012, 12:51 PM
  5. How to insert a row w/ a macro on a moving table?
    By adr150 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2010, 09:55 AM
  6. Macro insert row below table
    By 10XRay1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2009, 05:15 PM
  7. Macro for copy/insert into expanding table
    By Soslowgt in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-06-2008, 07:24 PM
  8. [SOLVED] Macro to insert extra rows in a table
    By Jonathan Oz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2005, 10:06 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