Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Microsoft Word Table display the number of rows in the table 4

Status
Not open for further replies.

Sherman6789

Programmer
Nov 12, 2002
127
0
0
US

We have a table which has five columns. Each row contains information concerning an event scheduled during the year. The first column of the rows list the name of the event. The last colum gives details. Each row can be anywhere from a few lines to a page in length. I was asked if there is a way that Word can tell us how many rows exist in the table without us having to count them.

I know that a WordPerfect table will display the number immediately (at the bottom of the screen) if the user places the cursor anywhere in the last row such as in column A. (Example Row: A235) This means that there are 235 rows in that table. I have not been able to find anything like that in MS Word tables.

Any help will be appreciated.
 
Try =COUNT(BELOW) in the first row or =COUNT(ABOVE) in the last row

Member- AAAA Association Against Acronym Abusers
 
MS Word does the same thing. If you click in the last row on a page it will have the number of "lines" or rows in the LN spot. I threw I table in that had 50 rows and found that a normal default page will hold 45. Not sure if there is a better way though.

Hope that helps.

Dan

Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body. But, rather to skid in sideways, chocolate in one hand, martini in the other, body thoroughly used up, totally worn out and screaming ~ WOO HOO what a ride!
 
XDHelp,

That is a better one. Have a Star [thmubsup]

Dan

Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body. But, rather to skid in sideways, chocolate in one hand, martini in the other, body thoroughly used up, totally worn out and screaming ~ WOO HOO what a ride!
 
Another way, to find the address of a table cell in Word, is to use a macro like:
Code:
Sub CellAddress()
If Selection.Information(wdWithInTable) = True Then
    If Selection.Cells(1).ColumnIndex > 26 Then
        StatusBar = "Cell Address: " & Chr(64 + Int(Selection.Cells(1).ColumnIndex / 26)) & Chr(64 + (Selection.Cells(1).ColumnIndex Mod 26)) & Selection.Cells(1).RowIndex
    Else
        StatusBar = "Cell Address: " & Chr(64 + Selection.Cells(1).ColumnIndex) & Selection.Cells(1).RowIndex
    End If
End If
End Sub
This one's based on a macro distributed by MS some years ago as part of the macro package that accompanied one version of Word.

Cheers

[MS MVP - Word]
 
Or if you are just wanting to know the row count - as I thought that was asked - you can use:
Code:
Sub RowCounter ()
[COLOR=red]'  keyboard shortcut = Alt-T[/color red]
If Selection.Information(wdWithInTable) = True Then
   StatusBar = "Current table has " & Selection.Tables(1).Rows.Count & _
        " rows."
Else
    MsgBox "Selection is not in a table."
End If
End Sub
Using the shortcut of Alt-T will either display the row count of the current table in the StatusBar, or a messagebox stating the Selection is not in a table.

Of course this could also be adapted to get information about any specific table, not just one the Selection is in.

Gerry
My paintings and sculpture
 
The number of rows is also in Table - Table Properties - Row. Though, sometimes it is necessary to click on the Table tab once inside Table Properties first and then click on the Row tab before it appears. It is below Size, next to Row. So if you click on the last row in the table you will get the number of rows in your table.
 
The macro, though, gets the number of rows of the table regardless of where the Selection is, in the table. You do not need to click the last row. The Selection can be anywhere in the table.

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top