problem with last line of a table in Microsoft Word

Occasionally, the bottom gridline of a table in Microsoft Word disappears (see image below). bottom gridline missingI have tried many ways to correct this: reformat the table, add a line, etc but nothing works to get the gridline back.

When I use the following code:
Sub GetAvg()
Dim cellLoop As Cell, CellContents, datePreviousVisit, intColumnIndex As Integer

intColumnIndex = Selection.Cells(1).ColumnIndex
Selection.GoTo wdGoToBookmark, , , "VitalSigns"
Selection.MoveDown wdLine, 1
Selection.HomeKey wdLine
Selection.MoveRight wdWord, 5, wdExtend
If IsDate(Selection.Range.Text) Then
    datePreviousVisit = InputBox("Enter Fill date:", , CDate(Selection.Range.Text))
Else
    datePreviousVisit = InputBox("Enter Fill date:")
End If
If Len(datePreviousVisit & "") = 0 Then Exit Sub Else datePreviousVisit = CDate(datePreviousVisit)
'Debug.Print Format(datePreviousVisit, "mmm dd, yyyy")
For Each cellLoop In ActiveDocument.Tables(3).Columns(intColumnIndex).Cells
        CellContents = Split(Left(cellLoop.Range.Text, Len(cellLoop.Range.Text) - 2), ",")
        If UBound(CellContents) = 1 Then
            cellLoop.Range.Text = Trim(CellContents(0))
            If CellContents(1) = "" Then CellContents(1) = 0
            cellLoop.Range.Text = Trim(CellContents(0)) & ", " & Trim(CellContents(1)) & ", " & Trim(Round((cellLoop.Range.Calculate - CellContents(1)) / DateDiff("d", datePreviousVisit, ActiveDocument.Bookmarks("DOS").Range.Text), 1))
        End If
Next cellLoop
ActiveDocument.Tables(3).Cell(1, intColumnIndex).Select
End Sub

Open in new window

with the missing gridline, I get this error message: "run time error 5992; Cannot access individual columns  in this collection because the table has mixed cell widths."

Is there a way to get the gridline back or a way to change the code so it runs with the missing gridline?

Thanks
LVL 39
thenelsonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ITSysTechSenior Systems AdministratorCommented:
If you click on an effected cell what does "Text Direction" show?

1.JPG
0
ITSysTechSenior Systems AdministratorCommented:
Also, try changing the alignment to "Top".

1.JPG
0
thenelsonAuthor Commented:
Text direction is normal:text direction
Alignment is already set to top:
alignment.png
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

ITSysTechSenior Systems AdministratorCommented:
There must be something causing this like a photo or your header. Have you tried to rearrange images on your document if you have any?
0
thenelsonAuthor Commented:
There are no images.  This problem usually (but not always) occurs when I copy and paste the table from another Word document.
0
ITSysTechSenior Systems AdministratorCommented:
Could you go to file>options>advanced and post what you have?

1.JPG
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITSysTechSenior Systems AdministratorCommented:
Inactive for 14 days
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.