Kutools for Excel 22.00 HOT

300+ Powerful Features You Must Have in Excel

Kutools-for-Excel

Kutools for Excel is a powerful add-in that frees you from performing time-consuming operations in Excel, such as combine sheets quickly, merge cells without losing data, paste to only visible cells, count cells by color and so on. 300+ powerful features / functions for Excel 2019, 2016, 2013, 2010, 2007 or Office 365!

Read More Download Buy now

Office Tab 14.00HOT

Adding Tabbed Interface for Office

Office Tab

It enables tabbed browsing, editing, and managing of Microsoft Office applications. You can open multiple documents / files in a single tabbed window, such as using the browser IE 8/9/10, Firefox, and Google Chrome. It's compatible with Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365. Demo

Read More Download Buy now

Kutools for Outlook 13.00NEW

100+ Powerful Features for Outlook

Kutools-for-Outlook

Kutools for Outlook is a powerful add-in that frees you from time-consuming operations which majority of Outlook users has to perform daily! It can save your time from using Microsoft Outlook 2019, 2016, 2013, 2010 or Office 365!

Read More Download Buy now

Kutools for Word  9.00NEW

100+ Powerful Features for Word

Kutools-for-Word

Kutools for Word is a powerful add-in that frees you from time-consuming operations which majority of Word users have to perform daily! It can save your time from using Microsoft Word / Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365!

Read More Download Buy now

Classic Menu for Office

Bringing Back Your Familiar Menus

Restores the old look and menus of Office 2003 to Microsoft Office 2019, 2016, 2013, 2010, 2007 or Office 365. Don’t lose time in finding commands on the new Ribbon. Easy to deploy to all computers in enterprises and organizations.

Read More Download Buy now

How to remove empty rows and columns from tables in Word?

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 clickgood idea3


Manually remove all empty rows and columns from tables

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:

doc-removerowsandcols-1

Step 3: Under Table Tools, click the Layout Tab;

doc-removerowsandcols-2

Step 4: In the Rows & Columns group, click Delete Rows or Delete Columns.

doc-removerowsandcols-3


Remove all empty rows and columns from tables by using VBA code

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 Rundoc-reverse-sign-6 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


Remove all empty rows and columns from tables with one click

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 Remve Empty Rows Cols 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 Enterprise > Remove empty rows and Cols on the Table pane.

doc remove blank rows columns from table 1

2. Then a dialog pops out for you to ensure remove blank rows and columns from all tables in the whole document, click Yes to continue, another dialog pops out to remind you the number of deleted rows and columns. Click Ok to close it.

  doc remove blank rows columns from table 2 doc arrow right  doc remove blank rows columns from table 3

Now the blank rows and columns have been removed from tables.

doc remove blank rows columns from table 4
doc arrow down
doc remove blank rows columns from table 5

Tip.If you want to remove blank rows from Excel sheet, the Delete Blank Rows utility of Kutools for Excel can help you.



Recommended Word Productivity Tools

 

Kutools For Word - More Than 100 Advanced Features For Word, Save Your 50% Time

  • Complicated and repeated operations can be done one-time processing in seconds.
  • Insert multiple images across folders into Word document at once.
  • Merge and combine multiple Word files across folders into one with your desired order.
  • Split the current document into separate documents according to heading, section break or other criteria.
  • Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    JK · 9 months ago
    You just saved me a zillion hours of frustration, THANK YOU!
  • To post as a guest, your comment is unpublished.
    helping · 1 years ago
    u know you can just resize the table right? just filter and sort your data to top check how many rows have data, click table tools and the click resize and adjust the last number to whatever you need OR go to the bottom of the table the very last cell and use the tine blue triangle to drag and resize,
    • To post as a guest, your comment is unpublished.
      Carol · 1 years ago
      Except I have multiple page document with a table with varying information in each. Furthermore, it is a merge document so different each week. I need an automated method :)
  • To post as a guest, your comment is unpublished.
    F · 2 years ago
    Hi, the macro is working, BUT:

    After deleting all rows, all the columns of the tables with empty rows open up very wide.

    How can i fix the code so that this does not happens?


    I am using Office 2016.


    Thank you!
  • To post as a guest, your comment is unpublished.
    GB · 3 years ago
    Hi All,

    I am looking for function in word wherein, if I remove specific word then it should remove that row as well.
  • To post as a guest, your comment is unpublished.
    Natasja · 3 years ago
    Thanks for the code, really useful.
  • To post as a guest, your comment is unpublished.
    jj511 · 4 years ago
    Is there a macro that will delete a row if only one of the cells in that row is empty or contains a zero?
  • To post as a guest, your comment is unpublished.
    heisenberg · 5 years ago
    thanks for the macro, it was really helpful..
  • To post as a guest, your comment is unpublished.
    Ken Grace · 5 years ago
    Thanks for the macro. It worked like a charm!
  • To post as a guest, your comment is unpublished.
    Andy Harris · 6 years ago
    Hello developers - I have this macro which sits in a button and when clicked (the macro) removes the table directly above the button. Can this be fixed so that the macro only works once? Ie. if there are 2 tables in the document only 1 is deleted - then the macro ceases to work... can you advise?

    Sub tableDelete()
    '
    ' tableDelete Macro
    'Dim nTables As Integer
    nTables = ActiveDocument.Tables.Count
    ActiveDocument.Tables(nTables).Delete

    '

    End Sub
    • To post as a guest, your comment is unpublished.
      Jay Chivo · 6 years ago
      [quote name="Andy Harris"]Hello developers - I have this macro which sits in a button and when clicked (the macro) removes the table directly above the button. Can this be fixed so that the macro only works once? Ie. if there are 2 tables in the document only 1 is deleted - then the macro ceases to work... can you advise?

      Sub tableDelete()

      Dim nTables As Integer
      nTables = ActiveDocument.Tables.Count
      ActiveDocument.Tables(nTables).Delete

      End Sub[/quote]

      Please try to use this VBA to delete all tables from current document in Word.

      [i]Sub tableDelete()

      Dim aTable As Table

      For Each aTable In ActiveDocument.Tables
      aTable.Delete
      Next

      End Sub[/i]

Feature Tutorials