Finding Tables that are Too Narrow or Too Wide

Written by Allen Wyatt (last updated August 8, 2026)

2

Orson has a document that is about 300 pages long and contains more than a hundred tables. The text area within the document is 6.5 inches. Orson needs a way to easily find any table that is less than 6.25 inches wide or more than 6.5 inches wide. This doesn't seem to be something he can do with Find and Replace, so he wonders if he will need a macro.

The short answer is yes, a macro is required to perform this type of analysis. Fortunately, the macro doesn't need to be very complex. It simply needs to step through each table, calculate the table width, and then make a determination of what to do if the width is outside of Orson's target width. The following macro performs exactly those steps:

Sub AnalyzeTableWidths()
    Dim tbl As Table
    Dim tblWidth As Double
    Dim tblCount As Long
    Dim sMsg As String
    Dim pg As Long
    Dim docReport As Document

    sMsg = ""
    tblCount = 0
    For Each tbl In ActiveDocument.Tables
        tblCount = tblCount + 1
        tblWidth = tbl.PreferredWidth / 72

        If tblWidth < 6.25 Or tblWidth > 6.5 Then
            pg = tbl.Range.Information(wdActiveEndPageNumber)
            If sMsg = "" Then
                sMsg = "Tables out of range (< 6.25"" or > 6.5""):"
                sMsg = sMsg & vbCrLf & vbCrLf
            End If
            sMsg = sMsg & "¥ Table #" & tblCount & " on page " & pg & _
            " (Width: " & Format(tblWidth, "0.00") & " in.)" & vbCrLf
        End If
    Next

    ' Show the results
    If sMsg = "" Then
        sMsg = "All tables are within the allowed width (6.25"" - 6.5"")."
    Else
        Set docReport = Documents.Add
        docReport.Content.Text = sMsg
        sMsg = "Scan complete! A summary report has been created "
        sMsg = sMsg & "in a new document."
    End If
    MsgBox sMsg, vbInformation, "Done"
End Sub

Note that the macro puts together a report in the sMsg string as it steps through each table. The report includes not only the width of the table, but also the page on which the table is located. When complete, if there is something in the report, then a new document is created and the report is placed there. If no tables were found outside the target width, then a message box to that effect is displayed.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13992) 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

Getting Rid of Custom Toolbars

If you start Word and get a bunch of unwanted toolbars displayed on the screen, you can be scratching your head (or ...

Discover More

Getting Excel Dates into Outlook's Calendar

If you want to move information from Excel into Outlook, how you do it can be a bit tricky. Here's an example of how you ...

Discover More

Adding a Custom Format to those Offered by Excel

Adding a custom format to Excel is easy. Having that custom format appear in all your workbooks is a different story ...

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)

Hiding Gridlines

For those times when you remove the borders from your tables, Word provides a way that you can display non-printing ...

Discover More

Setting Table Values to Three Decimal Places

If you import information into a document from another program, the values you import may not be exactly to your liking. ...

Discover More

Freezing Cell Size when Inserting Pictures

Insert a picture into a table cell, and you may quickly find that the table is no longer the size you expected. Here's ...

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 seven more than 1?

2026-08-09 09:37:16

beepee

Addendum to my comment 2026-08-08 11:51:35
I am still 'playing' trying to resolve this.
Having ventured into Copilot for some help I came up with the following...

The code snippet below, gets me the right results by adding column widths together to arrive at the table width.

For LoopCount = 1 To tblCount
Set tbl = ActiveDocument.Tables(LoopCount)
TableWidth = 0
For Each col In tbl.Columns
TableWidth = TableWidth + col.Width
Next col

With the original macro:
Hovering over - tbl.PreferredWidth – I get – TblPreferredWidth = 9999999 – I assume this is a default and maybe I need a - Set - statement somewhere, and that is what is scuppering the .PreferredWidth value?


2026-08-08 11:51:35

beepee

This could be really handy but...
I am using Windows 11 Office (Word) 2021
and with differnt sized tables in a document I get the following report:
¥ Table #1 on page 7 (Width: 138888.88 in.)
¥ Table #2 on page 37 (Width: 138888.88 in.)
¥ Table #3 on page 37 (Width: 138888.88 in.)
¥ Table #4 on page 57 (Width: 138888.88 in.)
¥ Table #5 on page 59 (Width: 138888.88 in.)

Obviously very wrong - I thought maybe my dimension settings in cm may be a problem. I reset this to inches with the same result. - even after a Close and re Open operation!
Any help please!


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.