Document Editing Problems

How to Automatically Hide or Collapse Rows in a Word Table

Emma BrownEmma Brown Nov 2, 2026 869 views

Question details

The user needs to conditionally hide specific rows containing comments and photos in a Word table when a task outcome is marked as 'not in scope'.

How to Automatically Hide or Collapse Rows in a Word Table
Product
Word
Device & OS
not provided
Scenario
Managing a complex document table where irrelevant data rows need to be collapsed or hidden automatically based on certain outcomes.
Observed behavior
Microsoft Word does not have a simple built-in feature to conditionally collapse or automatically hide specific table rows.
Before you start

Because this solution requires VBA macros, ensure your document is saved as a Word Macro-Enabled Document (.docm) and that the Developer tab is enabled in your ribbon.

Solution 1Recommended

Use a VBA Macro to Toggle the Hidden Font Property

Since Word cannot natively collapse table rows, you can use a custom VBA macro assigned to a MacroButton to hide and unhide bookmarked rows.

This method utilizes Word's 'Hidden' font property. By assigning a bookmark to the specific rows you wish to hide, a small VBA script can toggle their visibility on and off directly from a clickable button within the table.

1
Bookmark the target rows

Highlight the entire table row(s) you want to hide (including comments and photos). Go to the Insert tab, click Bookmark, type a name like 'Rows1' without spaces, and click Add.

2
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications editor. Go to Insert > Module to create a new module.

3
Add the Macro code

Paste the following code into the module window: Sub ShowHideRows1() If ActiveDocument.Bookmarks("Rows1").Range.Font.Hidden = False Then ActiveDocument.Bookmarks("Rows1").Range.Font.Hidden = True Else ActiveDocument.Bookmarks("Rows1").Range.Font.Hidden = False End If End Sub

4
Insert a MacroButton

Click inside the table row where you want the toggle button. Press Ctrl + F9 to insert field brackets. Inside the brackets, type 'MACROBUTTON ShowHideRows1 Click to Hide/Show'. Press F9 to update the field into a clickable text button.

Use a VBA Macro to Toggle the Hidden Font Property
Macro-Enabled Format: Remember to save your file as a Word Macro-Enabled Document (*.docm) so the VBA code functions correctly every time you open the document.
Free Microsoft Office alternative

Manage Complex Documents Efficiently with WPS Office

If dealing with missing features and complex VBA workarounds in Microsoft Word is slowing you down, try WPS Office. It provides a robust, lightweight, and completely free alternative for managing your documents, spreadsheets, and presentations without compromising on compatibility.

  1. 1. Download and Install WPS Office: Visit the official WPS website to download the free office suite and follow the simple installation instructions.
  2. 2. Open Your Existing Documents: Launch WPS Writer and open your existing .docx or .docm files directly. All your existing text, tables, and formatting will remain perfectly intact.
  3. 3. Edit Seamlessly: Use the highly compatible, all-in-one workspace to manage your tables, adjust your layouts, and finalize your document reports effortlessly.
Fully compatible with Microsoft Word (.docx and .docm) document formats.Lightweight and fast, ensuring smooth performance even with complex table formatting.Familiar, tabbed user interface that requires zero learning curve to master.Includes built-in PDF editing, document conversion, and powerful formatting tools for free.
microsoft office alternative - wps office

Frequently Asked Questions

Can I hide empty table rows automatically in Word without using macros?

No, Microsoft Word does not have a native feature to automatically hide or collapse empty rows or conditionally hide rows based on cell contents. You must either use a VBA macro or manually hide the text using the Font 'Hidden' property.

How do I manually hide specific text or rows in a Word table?

Select the text or the entire row you want to hide, right-click, and choose 'Font'. In the Font dialog box, check the 'Hidden' box under the Effects section and click OK. To view hidden text while editing, toggle the 'Show/Hide ¶' button located on the Home tab.

Will the row-hiding macro work if I send the document to someone else?

Yes, but only if the document is saved as a Macro-Enabled Document (.docm) and the recipient chooses to 'Enable Macros' when prompted by their word processor upon opening the file.