How to Record a Word Macro to Split a Table Cell
Question details
The user needs to record a macro to split a table cell in a Word document, but finds that the right-click context menu is unavailable during the recording process.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Automating table editing tasks by recording a macro.
- Observed behavior
- When the macro recorder is active, right-clicking a table cell to access the 'Split Cells' option does not work as it normally would.
Ensure you have the Developer tab enabled in your word processor's ribbon, as you will need it to start the Macro Recorder or open the Visual Basic Editor.
Use Ribbon Commands to Record the Split Cell Macro
Since the right-click menu is disabled during macro recording, you must use the standard ribbon commands to execute the split cell action.
The macro recorder in Word disables certain mouse interactions, such as right-clicking. To successfully record your macro, navigate through the top ribbon menus instead of using context menus.
Go to the Developer tab on the top ribbon and click on 'Record Macro'. Give your macro a name and click 'OK'.
Click inside the table cell that you wish to split while the recorder is running.
Navigate to the 'Table Tools - Layout' (or simply 'Layout') tab on the ribbon. In the 'Merge' group, click on the 'Split Cells' button.
In the dialog box that appears, choose the number of columns and rows you need (for example, 2 columns and 1 row), then click 'OK'.
Return to the Developer tab and click 'Stop Recording' to finalize your macro.

Use Direct VBA Code to Split the Cell
Instead of recording the actions manually, you can directly insert the VBA code into the Visual Basic Editor to perform the split.
Automate Table Adjustments Effortlessly with WPS Writer
WPS Office provides a highly capable word processor with robust macro and VBA support. You can easily record macros to automate table edits like splitting cells, utilizing a familiar interface that handles complex automation smoothly.
- 1. Download and install WPS Office: Get the free suite from the official WPS website and install it on your device.
- 2. Open your document: Launch WPS Writer and open the document containing the table you want to modify.
- 3. Enable the Developer tab: Go to Options to enable the Developer tab, giving you full access to Macro and VBA tools.
- 4. Record or paste your macro: Click 'Record Macro' and use the Table Tools tab to split your cell, or open the VBA Editor to paste your specific cell-splitting code.

Frequently Asked Questions
Why is the right-click menu disabled while recording a Word macro?
The macro recorder tracks explicit commands and keystrokes rather than mouse coordinate clicks. Right-click context menus are temporarily disabled to ensure that you select reliable, absolute command paths from the ribbon that the macro can repeat without error.
Can I modify the VBA code to split the cell into more rows or columns?
Yes. In the provided VBA code, you can easily alter the values for 'NumRows:=1' and 'NumColumns:=2' to whatever dimensions you require. For example, changing it to 'NumColumns:=3' will split the selected cell into three columns.
Will this split macro work if I have multiple cells selected?
The command 'Selection.Cells.Split' applies to the entire active selection. If you highlight multiple cells and run the macro, it will attempt to apply the split parameters to all selected cells, provided the table's structure supports the resulting grid layout.




