If sorting is not an options, you can use the macro below:
Sub DeleteEmptyRows_AllTables()
Dim oTable As Table
Dim oRow As Row
For Each oTable In ActiveDocument.Tables
For Each oRow In oTable.Rows
'Check whether row is empty - delete if it is
If Len(oRow.Range.Text) = oRow.Cells.Count * 2 + 2 Then
oRow.Delete
End If
Next oRow
Next oTable
End Sub
How it works:
The macro iterates through all tables in the active document and finds (and
deletes) the empty rows by checking the total string length of each row.
- An empty cell includes a cell maker with a length of 2
- In addition, each row includes an end of row marker with a length of 2
Therefore, the row is empty if the string length is equal to the number of
cells in the row multiplied by 2 + 2.
You will find another macro version at:
http://word.mvps.org/FAQs/MacrosVBA/DeleteEmptyRows.htm
NOTE that both macro versions will fail if the table contains vertically
merged cells (requires some error handling).
For help on installing macros, see:
http://www.gmayor.com/installing_macro.htm
--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word