VBA, Word Table Insert/Remove Rows/Columns

In this article I will explain how you can add and delete rows and columns from tables in a word document using VBA.

Every word document has a Tables collection The first step in working with a table in VBA for word is to determine the table index. Tables in a word document start from the index “1” and go up. So for example the first table would be referenced by using the statement below:


The second table would be reference by using:


and so on . . .

All examples in this article will use the table below as their initial table:

Word, Table Initial

Delete Row:

The code below will remove the second row of the first table:



Word VBA, Delete Row

Delete Column:

The code below will remove the second column of the first table:



Word VBA Delete Column

Insert Row:

The codes below will all insert an empty row after the first row:

Tables.Item(1).Rows.Add (Tables.Item(1).Rows.Item(2))

Selection.InsertRowsBelow (1)

Selection.InsertRowsAbove (1)

The Rows.Add gets as input a row object. The new row will be inserted before the input row. The function Selection.InsertRowsBelow inserts as many rows passed as the input parameter below the currently selected row.


Word VBA Delete Row Result

Insert Columns:

I find the column insertion methods a bit awkward. While there were 3 methods for inserting rows there are only 2 methods for inserting columns:



The first method inserts a column to the right of the selected column. The second inserts a column to the left of the selected column.

Word VBA insert column

You can download the file and code related to this article from the link below:

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website www.software-solutions-online.com

3 thoughts on “VBA, Word Table Insert/Remove Rows/Columns”

  1. alex says:

    for me does not work to insert a new row:

    Set wordapp = CreateObject(“word.Application”)
    Set wordDoc = wordapp.Documents.Open(“C:UsersandyDesktoptesty.doc”)
    wordapp.Visible = True
    Selection.InsertRowsBelow (1)

    1. pedrumj says:


      You will need to use the code below:

      Set wordapp = CreateObject("word.Application")
      Set worddoc = wordapp.Documents.Open( _
      wordapp.Visible = True
      wordapp.Selection.InsertRowsBelow (1)

      Please let me know if you have any other questions.

  2. Mihai says:

    This helped me a lot!
    I had trouble with some tables that had merged cells ( outside the area in which I was working ) that could not be accessed through rows().cells().range.text but only through cell().range.text
    In this case I could not find a method to add rows, the only thing I found was to delete them with cell(4, 1).Delete ShiftCells:=wdDeleteCellsEntireRow
    Nothing else would work on them.

    Thanks for the article, as a new VBA programmer it was a lot of help!

Leave a Reply

Your email address will not be published. Required fields are marked *