On Aug 14, 5:55*pm, "Patrick C. Simonds" <ordnan...@comcast.net>
wrote:
> I have 11 identical groups of OptionButtons each group consists of 6
> OpTionButtons. Each group has its own groupname. Is there any way to count
> how many of OptionButton4's have a True value?
Patrick,
Some sample code is below. I haven't tested it, but it should work.
I'm assuming your user form is UserForm1 and the target frame is
Frame1. Of course, you can adjust the user form and frame as needed.
Best,
Matthew Herbert
Dim Ctrl As MSForms.Control
Dim intCnt As Integer
For Each Ctrl In UserForm1.Frame1.Controls
If TypeOf Ctrl Is MSForms.OptionButton Then
If Ctrl.Value = True Then
intCnt = intCnt + 1
End If
End If
Next Ctrl
MsgBox "The number of true values in the specified " & vbLf & _
"form and frame is " & intCnt & "."
|