![]() |
#2
|
||||
|
||||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
cltay87 | Word VBA | 4 | 02-27-2017 04:23 AM |
![]() |
braddgood | Word VBA | 15 | 10-02-2015 01:54 PM |
![]() |
beginner | Excel Programming | 5 | 12-26-2014 12:29 AM |
![]() |
Bathroth | Word VBA | 1 | 10-01-2014 01:40 PM |
![]() |
ubns | Excel Programming | 2 | 08-14-2012 02:01 AM |