Automating a Two-Column Section

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:

  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

Consistent Spacing

It is a good idea to make sure that the spacing following each sentence in your document is consistent. Here's a handy ...

Discover More

Understanding and Using Batch Files

Batch files are a hold-over from the days of DOS, but they still provide some great features in the lastest versions of ...

Discover More

Changing from Absolute to Relative Hyperlinks

It is easy to amass a large number of hyperlinks in a document. You may want to process these hyperlinks in some way, ...

Discover More

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!

More WordTips (ribbon)

Trimming Spaces from Strings

When processing text with a macro, you often need to remove extraneous spaces from the text. VBA provides three handy ...

Discover More

Understanding Document Variables

When working with macros, you may want to create a variable that will remain constant from one instance of the macro to ...

Discover More

Determining if Caps Lock is On

If your macro needs to determine the status of the Caps Lock key, you need the code in this tip. Just use the Information ...

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 six more than 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.