How to Automatically Hide or Collapse Rows in a Word Table
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'.

- 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.
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.
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.
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.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications editor. Go to Insert > Module to create a new module.
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
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 Collapsible Heading Styles (For Non-Table Data)
If you can move your data out of a strict table format, Word's built-in collapsible headings offer a native, code-free 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. Download and Install WPS Office: Visit the official WPS website to download the free office suite and follow the simple installation instructions.
- 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. Edit Seamlessly: Use the highly compatible, all-in-one workspace to manage your tables, adjust your layouts, and finalize your document reports effortlessly.

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.




