![]() |
|
#2
|
|||
|
|||
|
You can test the whole row instead of the individual cells:
Code:
Sub PrintAllTest()
Dim oTbl As Table, lngIndex As Long, lngCols As Long, oUndo As UndoRecord
Application.ScreenUpdating = False
Set oUndo = Application.UndoRecord
oUndo.StartCustomRecord ("DeleteRows")
With ActiveDocument
For Each oTbl In .Tables
lngCols = oTbl.Columns.Count
For lngIndex = oTbl.Rows.Count To 1 Step -1
If Len(oTbl.Rows(lngIndex).Range) = (2 * lngCols) + 2 Then
oTbl.Rows(lngIndex).Delete
End If
Next lngIndex
Next oTbl
End With
Application.ScreenUpdating = True
oUndo.EndCustomRecord
MsgBox Dialogs(wdDialogFilePrint).Show
ActiveDocument.Undo
lbl_Exit:
Set oUndo = Nothing
Set oTbl = Nothing
Exit Sub
End Sub
|
| Tags |
| delete rows, undo, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to delete all empty rows from all tables
|
braddgood | Word VBA | 15 | 10-02-2015 01:54 PM |
| Find and Delete Rows | damaniam | Word VBA | 1 | 03-11-2014 06:54 AM |
Grouping table rows to prevent individual rows from breaking across pages
|
dennist77 | Word | 1 | 10-29-2013 11:39 PM |
Delete all rows but the last.
|
elky1967 | Word VBA | 14 | 09-21-2012 05:27 AM |
Macro to delete rows with all empty cells
|
ubns | Excel Programming | 2 | 08-14-2012 02:01 AM |