I have a table in word (a normal table, not a formfield), and the cells of the 3rd column of this table are checkboxes. I need to first check if the cells are of checkbox type, and then count the number of checked checkboxes within this column. I have tried this Macro, but I get error message that "the requested member of the collection does not exist.". I think it is because of my table is not a formfield. Is there any solution for a normal table?
Private Sub CommandButton2_Click()
Dim i As Long, j As Long, k As Long
k = 0
With ActiveDocument
With .Tables(1)
j = 3
For i = 1 To .Rows.Count
If .Cell(i, j).Range.FormFields(1).CheckBox.Value = True Then
k = k + 1
End If
Next i
i = .Rows.Count
End With
End With
MsgBox k & " instances were found"
End Sub
Aucun commentaire:
Enregistrer un commentaire