In the following article, we would like to offer you 3 effective ways to remove unwanted spaces in table cells in your Word document.
Now and then, we need to inset a table to hold texts and data. But we often have to adjust the table size after entering texts and data. And sometimes, we will get a table with unwanted spaces in cells after adjusting its size, such as below:
In the example above, there is a blank line below the text in each cell. But we are unable to get rid of it simply by pressing “Delete”. Instead, we have to use other workarounds.
Method 1: Narrow Down the Row Height Manually
- First and foremost, check if there are removable blank lines in cells. If any, delete them first.
- Then put cursor over the bottom line of a table row. Wait until cursor changes to the sign of double horizontal lines with 2 arrows.
- Next click and drag the bottom line up until the unwanted space disappears.
- Repeat step 2 and 3 on other rows in the table whose height needs to resize.
Here is the result:
Method 2: Disable “Specify height” Function
- First of all, click on the cross sign on the upper-left to select the entire table.
- Then right click and choose “Table Properties”.
- In “Table Properties” box. Click “Row” tab first.
- Next clear “Specify height” box.
- Lastly, click “OK”.
The effect is as same as that in method 1.
Method 3: Use Word Macro
- To start off, click “Developer” then “Visual Basic” to open VBA editor. If the “Developer” tab is not available in the Ribbon, press “Alt+ F11” instead.
- Next, go to create a new module. Click “Normal” in the left column.
- Then click “Insert” at the menu bar.
- Choose “Module” on the drop-down menu.
- Next double click on module to open it.
- Now paste the following codes on the coding area:
Sub RemoveSpacesInTables() Dim objTable As Table Dim objDoc As Document Set objDoc = ActiveDocument With objDoc If .Tables.Count > 0 Then For Each objTable In .Tables objTable.Select Selection.Rows.HeightRule = wdRowHeightAuto Selection.Rows.Height = InchesToPoints(0) Next objTable Else MsgBox ("This document contains no table.") End If End With End Sub
- Finally, click “Run” or execute the codes pressing “F5”.
This macro shall work on all tables in a document and remove unnecessary spaces.
Comparison of 3 Methods
Methods | Advantages | Disadvantages |
Method 1: Narrow Down the Row Height Manually | Best for a document with only a few tables or tables with a few rows. | 1. You have to pull up the row line up manually and repeatedly.
2. Not the nest way for multiple tables |
Method 2: Disable “Specify height” Function | 1. No need to manually pull the line up
2. Quicker than method 1 |
You can only deal with one table at a time. |
Method 3: Use Word Macro | 1. The quickest way
2. Able to process multiple tables at a time |
It requires the use of a macro. |
Once a Document Corrupts
It’s not rare to get a corrupted document now and then. However, the moment your document is damaged, it’s also the time when fear sets in. Therefore, just to be on the safe side, the quickest course of action is to obtain a repairing tool to fix docx so as to prevent it from further damage.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair Excel and pdf repair software products. For more information visit www.datanumen.com