![]() |
|
#2
|
|||
|
|||
|
Hi! Try this:
Code:
Sub DeleteEmptyRows_If()
'In the doc's 2nd tbl, delete rows if any of their cells starting from the 3rd cell is empty.
Dim tbl As Table, cel As cell
Dim i As Long, j As Long, n As Long
Application.ScreenUpdating = False
Set tbl = ActiveDocument.range.Tables(2)
n = tbl.rows.count
For i = n To 1 Step -1
For j = 3 To tbl.rows(i).Cells.count
Set cel = tbl.rows(i).Cells(j)
If Len(cel.range.text) = 2 Then
tbl.rows(i).Delete
Exit For
End If
Next j
Next i
Set cel = Nothing: Set tbl = Nothing
Application.ScreenUpdating = True
End Sub
Last edited by vivka; 01-11-2024 at 07:37 AM. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Index hyperlinks refer to old version of document
|
Perkzzz | Word | 7 | 11-13-2016 06:54 PM |
Change Macro so it does not refer to "Active Document"
|
trent.bourne | Word VBA | 2 | 10-30-2016 01:49 AM |
Trying to refer to a placeholder several times throughout a document
|
caitlin | Word VBA | 2 | 11-16-2015 04:29 AM |
Excel table: refer to a particular row?
|
tinfanide | Excel | 10 | 08-05-2015 01:17 PM |
| How do I refer to page numbers, when the numbers change as I prepare the document? | StevenD | Word | 5 | 11-29-2012 12:52 AM |