How to count number of rows~

  • Thread starter Thread starter drybones
  • Start date Start date
D

drybones

Have a 7 page, single rowed, one line per row, Table.
Word 2002.
Is there a way to get word to count the rows?

Many thanks,
drybones
 
I know how *I* would do it but it may not bean option to you.

I'd copy the table and paste it in to an Excel spreadsheet. Those numbered
rows come in handy. :-)

(You may laugh at me but it works and it's a lot easier than counting!)
 
If you sort out the prematurely wrapped lines, the Table Cell Helper as
supplied with some versions of Word in macros8.dot (and reproduced below)
will identify the location of any cell in a table and give the number of
lines. See http://www.gmayor.com/installing_macro.htm

Sub TableCellHelper()
'************************************
'* Declarations *
'* Section *
'************************************

Dim TC%, TR%, FC%, LC%, FR%, LR%, dummy%, Row%, Col%
Dim FTC&, LCT&
Dim Q1Dbl$, Q2Dbl$
Dim Msg1$, Msg2$, Msg3$, Msg4$, Msg5$, Msg6$, Title$

'************************************
'* Initialization *
'* Section *
'************************************

Msg3$ = "Your selection must be entirely within a single table."
Msg6$ = "Word cannot display the total columns and or rows because some
cells are either split or merged."
Title$ = "Table Cell Helper"

If Application.Documents.Count Then
If Selection.Information(wdWithInTable) Then
Col = Selection.Information(wdMaximumNumberOfColumns)
Row = Selection.Information(wdMaximumNumberOfRows)
FC = Selection.Information(wdStartOfRangeColumnNumber)
LC = Selection.Information(wdEndOfRangeColumnNumber)
FR = Selection.Information(wdStartOfRangeRowNumber)
LR = Selection.Information(wdEndOfRangeRowNumber)
FCT = FC / 26
Select Case FCT
Case 0 To 1
Q1Dbl = ""
Case Is <= 2
Q1Dbl = "A"
FC = FC - 26
Case Else
Q1Dbl = "B"
FC = FC - 52
End Select
LCT = LC / 26
Select Case LCT
Case 0 To 1
Q2Dbl = ""
Case Is <= 2
Q2Dbl = "A"
LC = LC - 26
Case Else
Q2Dbl = "B"
LC = LC - 52
End Select
Msg1$ = "At cell " & Q1Dbl & Chr$(Val(FC) + 64) & ":" & LR & "."
Msg2$ = "Selected cell range is " & Q1Dbl & Chr$(Val(FC) + 64) & FR
& ":" & Q2Dbl & Chr$(Val(LC) + 64) & LR & "."
Msg5$ = "There are a total of " & Col & " columns, and " & Row & "
rows in this table."
If FC = LC And FR = LR Then
dummy = MsgBox(Msg1$ & " " & Msg5$, vbOKOnly, Title$)
Else
dummy = MsgBox(Msg2$ & " " & Msg5$, vbOKOnly, Title$)
End If
Else
dummy = MsgBox(Msg3$, vbOKOnly, Title$)
End If
On Error GoTo TError
End If
Exit Sub

TError:
If Err = 5992 Then
dummy = MsgBox(Msg6$, vbOKOnly, Title$)
End If
Resume Next
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Many thanks to both, Graham and J0Ann for your helpful replies.

Will give JOAnn's a go and then Graham's.

drybones
 
Back
Top