Delete Empty Rows from All Tables in Word with One Click

Sometimes, your Word document may contain multiple tables, and some of them might have empty rows. Deleting these blank rows manually can be a time-consuming and tedious task. In this blog post, I will show you how to quickly remove delete or empty rows from all table in your word document with just one click using a simple Microsoft Word VBA code.

remove blank rows from all tables in word

Following these steps to delete empty or blank rows from all tables in word document.

  1. Open VBA Editor: Press ALT+F11 Shortcut Key from your keyboard
Microsoft Word VBA Editor
  1. Create a new Module : In VBA Editor click on Insert Menu, then Click on Module
Create New Module in VBA Editor
  1. Past the following code into the module
  Sub deleteBlankRows()
     Dim tbl As Word.Table
     Dim cols As Long
     Dim cel As Word.Cell
       For Each tbl In ActiveDocument.Tables
       cols = 2
       tbl.Columns(cols).Select
       For Each cel In Selection.Cells
           If Len(cel.Range.Text) = 2 Then
              cel.Range.Rows(1).Delete
           End If
       Next
       Next
  End Sub
VBA Code to Delete empty rows from all tables with one click in word
  1. Press CTRL+S (to Save the Code), Press F5 (to Directly RUN the Code) and close the VBA Editor
  2. To test your VBA macro, press ALT + F8 on your keyboard to open the Macros dialog box. From the list of available macros, select the one you created and click Run
delete all empty rows from all tables in word

This is how you can automate the process of removing empty or blank rows from all tables in word using VBA. To make the process faster assign keyboard shortcut to your VBA Macros.

How to Assign keyboard shortcut to VBA Coded Macros

I hope this tutorial will help you delete blank or empty rows from all tables in word document in one click, if you have any question suggestion or feedback feel free to contact us using the information provided on our contact us page.

Thank you for your feedback & support.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *