Turn line numbers on and off in Word 2002

Power User Corner

By Paul Cornell

Displaying line numbers in your Word documents is a great way to reference particular portions of a document. Line numbers are used primarily in the legal, insurance, and medical communities, but they can be a helpful tool for anyone.

Applies to
Microsoft Word 2002

See all Power User columns
See all columns


When you refer to portions of documents, it is sometimes much easier to say "refer to line 32" than to say "refer to the third line in the second paragraph." If you work with long legal or medical documents, you know how helpful such a feature can be. But even referring to sections in a business report or memo is made easier by using line numbers.

You can display or remove line numbers in Microsoft Word 2002 either manually or by using a macro.

Display or remove line numbers

You can display or remove line numbers in an open Word document by using the settings of the Page Setup dialog box. To view line numbers, the document must be displayed in print layout view.

To display line numbers

  1. Start Word. A new, blank document opens.
  2. Type some text in the document. Make sure that the text is more than one line in length.
  3. On the View menu, click Print Layout.
  4. On the File menu, click Page Setup.
  5. In the Page Setup dialog box, click the Layout tab, and then click Line Numbers.
  6. Select the Add line numbering check box.
  7. Click OK and then click OK again. Line numbers are displayed on the left side of the document.

To remove line numbers

  1. Repeat steps 4 and 5.
  2. Clear the Add line numbering check box, and then click OK twice to close the dialog boxes. The line numbers are removed.

Tips

  • To start line numbering at a number other than 1, change the number in the Start at box in the Line Numbers dialog box.
  • To change line numbers from multiples of one to different multiples, such as multiples of five (5...10...15 and so on), change the number in the Count by box in the Line Numbers dialog box.
  • To change the numbering behavior, in the Line Numbers dialog box, click the Restart each page option, Restart each section option, or Continuous option.

Turn line numbering on or off automatically

You can create a macro to turn line numbering on or off automatically so that you don't have to adjust your page setup each time. If line numbers are not being displayed, the macro can add them; or, if line numbers are already being displayed, the same macro can remove them.

To turn line numbering on or off automatically by using a macro

  1. Start Word if it is not already running.
  2. On the Tools menu, point to Macro, and then click Macros.
  3. In the Macro name box, type ToggleLineNumbering.
  4. In the Macros in list, select Normal.dot (global template).
  5. Click Create. The Microsoft Visual Basic® Editor opens.
  6. Between the lines of code Sub ToggleLineNumbering() and End Sub either type or copy and paste the following code:
With ActiveDocument.PageSetup.LineNumbering
    If .Active = False Then
        .Active = True
        .StartingNumber = 1
        .CountBy = 1
        .RestartMode = wdRestartContinuous
    Else
        .Active = False
    End If
End With
  1. On the File menu of the Visual Basic Editor, click Close and Return to Microsoft Word.
  2. On the Tools menu, point to Macro, and then click Macros.
  3. In the list of macros, click ToggleLineNumbering, and then click Run. If line numbers were not visible, they are now added; if line numbers were visible, they are now removed.

Tips

  • To start line numbering at a number other than 1, you can change the number 1 in this line of code: .StartingNumber = 1
  • To change line numbers from multiples of one to different multiples, you can change the number 1 in this line of code: .CountBy = 1
  • To change the line numbering behavior, you can change the word wdRestartContinuous in this line of code: .RestartMode = wdRestartContinuous
    • To restart line numbering after each page, change the word to wdRestartPage.
    • To restart line numbering after each section, change the word to wdRestartSection.

Keep sending that e-mail!

We look forward to receiving your e-mail messages at pwruser@microsoft.com. We really want this to be your column, so please send us your comments and favorite handcrafted Office solutions. Remember, we will not be able to feature every Office solution that we receive, we will not have the time to respond to all of your e-mail, and we are not technical support representatives. But most of the articles that we write are based on the great e-mail that you send us.


About the author

Paul Cornell works for the Office Help team. In addition to contributing to the Office Power User Corner column, Paul contributes to the Office Talk column for the Microsoft Developer Network (MSDN). He is the author of the book Accessing and Analyzing Data with Microsoft Excel.

If you like this column and want to hear about more fun and useful Office offerings, sign up for our newsletter.

See all Power User columns
See all columns