count table non empty cells

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
 
D

Doug Robbins - Word MVP

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
 
C

Crios

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.
 
D

Doug Robbins - Word MVP

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
 

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