Is it possible to change it to work on a table with split rows as well?
I would very much thank you if you have a solution for me.
How can you remove the all empty rows and columns from tables in Word? This tutorial will show you several ways to remove empty rows and columns from tables in Word document.
Manually remove all empty rows and columns from tables
Remove all empty rows and columns from tables by using VBA code
Remove all empty rows and columns from tables with one click
Microsoft Office Word does not provide a convenient way to remove empty rows and columns, and you need to remove them by manually select each empty row and column and then delete them one by one.
Step 1: Select the empty row or empty column you want to delete. See screenshot:
Step 3: Under Table Tools, click the Layout Tab;
Step 4: In the Rows & Columns group, click Delete Rows or Delete Columns.
The Macro Function of Word provides a much more convenient way to remove all empty rows and columns from tables in document. You can remove all empty rows and columns as follows.
Step 1: Press “Alt-F11” to open the Microsoft Visual Basic for Application window;
Step 2: Click Module on the Insert tab, copy and paste the following VBA code into the Module window;
Step 3: Then click Run button to apply the VBA.
The VBA code to remove all empty rows and columns from tables:
Sub DeleteEmptyTablerowsandcolumns()
Application.ScreenUpdating = False
Dim Tbl As Table, cel As Cell, i As Long, n As Long, fEmpty As Boolean
With ActiveDocument
For Each Tbl In .Tables
n = Tbl.Columns.Count
For i = n To 1 Step -1
fEmpty = True
For Each cel In Tbl.Columns(i).Cells
If Len(cel.Range.Text) > 2 Then
fEmpty = False
Exit For
End If
Next cel
If fEmpty = True Then Tbl.Columns(i).Delete
Next i
Next Tbl
End With
With ActiveDocument
For Each Tbl In .Tables
n = Tbl.Rows.Count
For i = n To 1 Step -1
fEmpty = True
For Each cel In Tbl.Rows(i).Cells
If Len(cel.Range.Text) > 2 Then
fEmpty = False
Exit For
End If
Next cel
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
Kutools for Word provides you the most convenient way to remove all empty rows and columns from tables in document. You just need to click once, and Kutools for Word' s Delete Rows/Columns utility will remove all empty rows and columns from all or selecetd tables for you quickly.
Kutools for Word, with more than 100 handy functions, makes your jobs easier. | ||
After installing Kutools for Word, please do as below:(Free Download Kutools for Word Now!)
1. Click Kutools Plus > Delete Rows/Columns on the Table pane.
2. Then a dialog pops out, choose the scope that you want to remove tables from in the Look in section, then check Row option and Blank row option, or check Column option and Blank row option as you need. If you want to delete all blank rows and columns, you need to apply this operation twice.
![]() |
![]() |
Now a dialog pops out to remind you how many tables have been dealed with, click OK to close, and the blank rows and columns have been removed from tables.