Hi,
I have a Word document with 2 tables. The macro I want to run should only apply to the second table. How do I do this? Please explain like I'm 5?
Sub DeleteEmptyRows()
Dim tbl As Table, cel As Cell
Dim i As Long, j As Long, n As Long, fEmpty As Boolean
Application.ScreenUpdating = False
With ActiveDocument
For Each tbl In .Tables
n = tbl.Rows.Count
For i = n To 1 Step -1
fEmpty = True
For j = 3 To tbl.Rows(i).Cells.Count
Set cel = tbl.Rows(i).Cells(j)
If Len(cel.Range.Text) > 2 Then
fEmpty = False
Exit For
End If
Next j
If fEmpty = True Then tbl.Rows(i).Delete
Next i
Next tbl
End With
Set cel = Nothing: Set tbl = Nothing
Application.ScreenUpdating = True
End Sub