Written by Allen Wyatt (last updated July 11, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Ralph has a document in which a large number of sections have to be displayed in two columns, with a line between the columns. He wonders if there is a way to automate that process.
As with most suggestions to automate things in Word, the solution involves the use of a macro. And, as with any macro, you need to understand what the macro needs to do before creating it. In Ralph's case, creating his two-column sections inevitably involves the following steps:
With the steps understood, a macro implementation is relatively straightforward. A macro would have no way of knowing where you want the two-column section to begin and end, so it makes sense that a prerequisite for the macro is that you need to select the text you want in the new section. That way the macro can place a section break at the beginning of the selected text and just after it. Here's a sample macro:
Sub Insert2ColSection() Dim selStartPara As Paragraph Dim selEndPara As Paragraph Dim rng1 As Range ' start of selected paragraphs Dim rng2 As Range ' ending of selected paragraphs Dim rng3 As Range ' newly inserted section ' Check to see if selection has been made If Selection.Type = wdSelectionIP Then MsgBox "Please select some text first.", vbExclamation Exit Sub End If ' Get the paragraphs at the start and end of the selection. ' Necessary because you want to place your section breaks between ' existing paragraphs, not within paragraphs. Set selStartPara = Selection.Paragraphs(1) Set selEndPara = Selection.Paragraphs(Selection.Paragraphs.Count) ' Insert continuous section break after the ending paragraph Set rng2 = selEndPara.Range rng2.Collapse Direction:=wdCollapseEnd rng2.InsertBreak Type:=wdSectionBreakContinuous ' Insert continuous section break before the starting paragraph Set rng1 = selStartPara.Range rng1.Collapse Direction:=wdCollapseStart rng1.InsertBreak Type:=wdSectionBreakContinuous ' Get the range between the two inserted section breaks Set rng3 = rng1.Duplicate rng3.End = rng2.End ' Apply two-column formatting with line between If rng3.Sections.Count = 1 Then With rng3.Sections(1).PageSetup.TextColumns .SetCount NumColumns:=2 .LineBetween = True End With End If End Sub
The macro first checks to ensure that a selection has been made. If not, then the macro exits. If so, then the macro determines the first paragraph in the selection (selStartPara) and the ending paragraph in the selection (selEndPara). Continuous section breaks are then inserted after the ending paragraph and before the first paragraph.
Finally, the newly inserted section is selected and the two-column formatting, with a line, is applied. Since the macro works exclusively with ranges, the original text selected by the user before running the macro is not disturbed.
If you want to adjust the macro to use a different number of columns in the selected text, just change the value assigned to NumColumns near the end of the macro.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13234) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
Discover the Power of Microsoft Office This beginner-friendly guide reveals the expert tips and strategies you need to skyrocket your productivity and use Office 365 like a pro. Mastering software like Word, Excel, and PowerPoint is essential to be more efficient and advance your career. Simple lessons guide you through every step, providing the knowledge you need to get started. Check out Microsoft Office 365 For Beginners today!
When processing text with a macro, you often need to remove extraneous spaces from the text. VBA provides three handy ...
Discover MoreWhen working with macros, you may want to create a variable that will remain constant from one instance of the macro to ...
Discover MoreIf your macro needs to determine the status of the Caps Lock key, you need the code in this tip. Just use the Information ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments