In this article, we would like to show you 5 quick methods to batch delete multiple rows or columns in your Word table.
We put data into tables to make document easy to the eye. It’s not uncommon to create a long table. However, when you check the table again and find some rows and columns unnecessary, you will need a quick way to remove them.
First let’s look at ways to delete multiple consecutive rows or columns.
Method 1: Delete Rows or Columns through Contextual Menu
- Firstly, select a series of rows or columns and right click.
- Then choose “Delete Rows” or “Delete Columns” accordingly.
- Or you can select rows or columns and click “Layout”.
- Then choose “Delete” and select “Delete Columns” or “Delete Rows”.
Method 2: Use Shortcuts
- Firstly, select rows or columns.
- Secondly, press “Backspace”.
Now if the columns or rows are non-consecutive, we cannot delete them using above methods. Instead, you can deploy following methods.
Method 3: Put Unnecessary Rows or Columns Together
- Select a row or column first.
- Then click mouse and hold on.
- Drag the mouse to a proper position and release.
- Then select all target rows or columns and using above methods to delete them.
Method 4: Run a Macro to Delete Multiple Non-consecutive Rows
- First and foremost, select rows.
- Press “Alt+ F11” to open VBA editor in Word.
- Then create a module by clicking “Normal’’ project.
- Next click “Insert” and choose “Module”.
- Open the module with double click and paste following codes:
Sub DeleteNonConsecutiveRows() Dim objCell As Cell Dim objTable As Table Dim nIndex As Integer, nRows As Integer Dim strTable As String Dim varCellEmpty As Boolean Application.ScreenUpdating = False ' Delete contents in selected rows. Selection.Delete With Selection.Tables(1) nRows = .Rows.Count For nIndex = nRows To 1 Step -1 For Each objCell In .Rows(nIndex).Cells If Len(objCell.Range.Text) > 2 Then varCellEmpty = False Exit For Else varCellEmpty = True .Rows(nIndex).Delete End If Next objCell Next nIndex End With Set objCell = Nothing Set objTable = Nothing Application.ScreenUpdating = True End Sub
- Last but not the least, click “Run” or hit “F5”.
Method 5: Run a Macro to Delete Multiple Non-consecutive Columns
- First of all, select target columns with “Ctrl” key.
- Next install and run a macro following exact same steps above.
- But replace macro with this one:
Sub DeleteNonConsecutiveColumns() Dim objCell As Cell Dim objTable As Table Dim nIndex As Integer, nColumns As Integer Dim strTable As String Dim varCellEmpty As Boolean Application.ScreenUpdating = False ' Delete contents in selected columns. Selection.Delete With Selection.Tables(1) nColumns = .Columns.Count For nIndex = nColumns To 1 Step -1 For Each objCell In .Columns(nIndex).Cells If Len(objCell.Range.Text) > 2 Then varCellEmpty = False Exit For Else varCellEmpty = True .Columns(nIndex).Delete End If Next objCell Next nIndex End With Set objCell = Nothing Set objTable = Nothing Application.ScreenUpdating = True End Sub
Watch out Document Corruption
With the increase use of digital storage device, it’s important to take care of data. One of the best ways is to back them up. For example, while using Word, it can stop responding all of a sudden. And when it’s back to normal, you can only find your document dead. And then you will have to go through all the fuss of docx recovery.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx fix and pdf repair software products. For more information visit www.datanumen.com