Last table row

S

Sandy

Hi, I'm using Word 03.

I have the following macro:

Sub Shade()
Dim tblTable As Table
If ActiveDocument.Tables.Count >= 1 Then
For Each tblTable In ActiveDocument.Tables
tblTable.Rows(1).Shading.BackgroundPatternColor =
wdColorBrightGreen
Next tblTable

End If
End Sub

HOW DO I REFER TO THE LAST ROW IN THE TABLE INSTEAD OF #1? THE LAST ROW'S
INDEX NUMBER CAN VARY. THANKS
 
R

Robert Paulsen

You can use the index property of the last row (i.e.
Selection.Tables(1).Rows.Last.Index).
 
J

Jay Freedman

You can also use Selection.Tables(1).Rows.Count.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top