Sub addmeup()
'determines %complete based on the value of items
'stored in text fields Text1-Text5
'"Y" is counted as a completed item
'"N" is counted as an incomplete item
'and any other values are NOT included in the calculation
'Copyright Jack Dahlgren, April 2002

Dim t As Task
Dim ts As Tasks
Dim mypercent As Long
Dim counter, items As Integer

Set ts = ActiveSelection.Tasks
If Not ts Is Nothing Then
    For Each t In ts
    If Not t Is Nothing Then
        If Not t.Summary Then
            counter = 0
            items = 0
            mypercent = 0
            If t.Text1 = "Y" Then
                counter = counter + 1
                items = items + 1
            End If
            If t.Text1 = "N" Then
                items = items + 1
            End If
            If t.Text2 = "Y" Then
                counter = counter + 1
                items = items + 1
            End If
            If t.Text2 = "N" Then
                items = items + 1
            End If
            If t.Text3 = "Y" Then
                counter = counter + 1
                items = items + 1
            End If
            If t.Text3 = "N" Then
                items = items + 1
            End If
            If t.Text4 = "Y" Then
                counter = counter + 1
                items = items + 1
            End If
            If t.Text4 = "N" Then
                items = items + 1
            End If
            If t.Text5 = "Y" Then
                counter = counter + 1
                items = items + 1
            End If
            If t.Text5 = "N" Then
                items = items + 1
            End If
            If items > 0 Then
                mypercent = 100 * (counter / items)
            Else: mypercent = 0
            End If
            t.PercentComplete = mypercent
        End If
    End If
Next t
End If
End Sub