How to Count Number of Rows in a Word Table?

Microsoft Word does not have an automatic feature to count the number of rows in a table; however, you can create a simple macro to return these values

Method 1: Use the Information property to return the number of rows

Use the Microsoft Visual Basic for Applications Selection.Information property to return the number of rows in a table.

NOTE: The insertion point must be located in the table before you run the macro.

 Sub numRowsInCurrentTable() MsgBox Selection.Information(wdMaximumNumberOfRows) End sub

 

 

Method 2: Use the the Tables property to return the number of rows

Use the Microsoft Visual Basic for Applications Tables property to return the number of rows within a table. This method will return the total number of rows for the first table in the document. The insertion point does not need to be in the table.

 Sub numRowsInSpecificTable() MsgBox ActiveDocument.Tables(1).Rows.Count End Sub

Quick Steps

  • Open MS Word and Select any table
  • Press Alt+F11, Copy Paste the code in this Article
  • Press F5.

Show Comments

No Responses Yet

Leave a Reply