Automating a Two-Column Section

Written by Allen Wyatt (last updated July 12, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365


2

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:

  1. Insert a continuous section break at the beginning of where you want the columns to begin.
  2. Insert a continuous section break at the beginning of where you want the single column to resume.
  3. Position the insertion point between the two section breaks.
  4. Format the section to use two columns with a line between the columns.

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:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Massive Printouts

Have you ever wanted to do a simple printout, only to find that Excel spit out dozens of pages, and most of them were ...

Discover More

Printing a Key Assignment List

When you create custom shortcut keys in Word, you may (at some point) want to get a printout of what those key ...

Discover More

Understanding Functions

Do some macro programming in VBA and you'll quickly find out that you can use functions to extend the power and ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2019. Spend more time working and less time trying to figure it all out! Check out Word 2019 For Dummies today!

More WordTips (ribbon)

Understanding the While...Wend Structure

One of the basic programming structures used in VBA is the While ... Wend structure. This structure helps to make the ...

Discover More

Controlling Repagination in Macros

Want to turn off document repagination while your macro does its work? Here are two approaches you can use.

Discover More

Converting Inches to Points

Typographical measurements are often expressed in points. There are several formatting settings that, when accessed ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 5 - 4?

2025-07-14 15:56:10

Paul F. Stregevsky

Michael (Micky) Avidan,
Your approach is the manual way. Alan's post is about automating those steps.
A nonmacro way to automate the steps is to create the dual-column section one time,; select it, along with the section breaks that bracket it; save it as a Building Block, and select that building block in the Building Blocks dropdown list (located in your ribbon or toolbar) when you need it. Poof! Your 2-column section is inserted, followed by a section break that will return you to single-column formatting.


2025-07-12 14:46:58

Michael (Micky) Avidan

The same can be done by using Word’s Built-in Columns (with Vertical Line)

1. Select the section you want to format (or place your cursor at the start of it).
2. Go to the Layout tab (or Page Layout, depending on your version) > Click Columns > More Columns > Choose Two columns > Check the "Line between" box > Click OK.
*** The section will now be in two columns with a dividing line (newspaper layout)

*** To apply this formatting to multiple sections, you can:
Add section breaks between each part (Layout > Breaks > Section Break: Next Page).
Now, apply the column formatting to each section individually OR if all sections follow the same pattern, select the entire document and apply
columns in one step.


This Site

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.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.