count table non empty cells

  • Thread starter Thread starter Crios
  • Start date Start date
C

Crios

Hi
Layout: WXP SP3, Office 2003.

I have a table that has checkmarks in some of it's cells (one character per
cell) . I want to use a formula field in the last cell of each column that
counts the non empty cells (the ones with checkmarks) from that column.

Thanx

Crios
 
Exactly what are the checkmarks? Are they FormFields as used in document
that is protected for filling in forms?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Plain characters (one char per cell - may be replaced with an "x"). Simple
table, no forms, no protection. The issue a field with a formula for
counting non empty cells from each column.
 
With the selection in the table, run a macro that contains the following
code:

Dim i As Long, j As Long, k As Long
With Selection.Tables(1)
'Assumes there is a header row
'Replace 2 with 1 in next line if not.
For i = 2 To .Rows.Count
With .Rows(i)
k = 0
For j = 1 To .Cells.Count - 1
If Len(.Cells(j).Range.Text) > 2 Then
k = k + 1
End If
Next j
.Cells(.Cells.Count).Range.Text = k
End With
Next i
End With

If you do not know what to do with the above, See
http://www.gmayor.com/installing_macro.htm

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Back
Top