VBA to add table row at top of table

  • I am new working with excel VBA coding, and I am trying to add a button that will allow me to add a new table row at the top of the table. It is important that it only adds a table row and not an entire row. I have seen one post online that allows you to add a new row directly below the button's location. This would work, but it would need to be written to only add the table row. I can provide this if necessary, but it would take a little searching for me to find it again.


    The second part to this request, is that I would like the code to then open a pop-up prompt requesting inputs for the various columns. This is not necessary but would be very cool to have added in as well!


    Thanks in advance!

  • Hello and Welcome to the Forum ...:smile:


    In order to insert a row at the top of your table ... you can test following


    Code
    ActiveSheet.ListObjects("Table1").ListRows.Add (1)


    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim,


    That is very helpful, one issue is the formatting is matching with the row above, and I need it to match the row below, can you help with this?


    Also do you have any idea how to also create a pop-up window that asks for the inputs to go in the new row?


    Thanks!

  • Hello,


    Just a couple of remarks ...


    1. Do not know how to modify the formatting of the first row within your Table ...:duh:


    2. Your second question is very distinct and is related to creating a UserForm for User Input ... which requires you to create a new thread ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!