View Single Post
 
Old 01-02-2018, 10:24 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following shouldn't change the format of the table, but if it does, post a document with the errant table. The macro will not work with vertically merged cells

Code:
Sub DeleteEmptyRows()
'Graham Mayor - http://www.gmayor.com - Last updated - 03 Jan 2018
Dim oTable As Table
Dim iRow As Integer
Dim iCol As Integer
    Set oTable = Selection.Tables(1)
    If Selection.Information(wdWithInTable) Then
        For iRow = oTable.Rows.Count To 1 Step -1
            iCol = oTable.Rows(iRow).Cells.Count
            If Len(oTable.Rows(iRow).Range) = (iCol * 2) + 2 Then
                oTable.Rows(iRow).Delete
            End If
        Next iRow
    Else
        MsgBox "Selection is not in a table"
    End If
lbl_Exit:
    Set oTable = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote