Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting OptionButtons
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting OptionButtons
On Aug 14, 5:55*pm, "Patrick C. Simonds"
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 & "." |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting OptionButtons
You are going to have to clarify what you mean by "count how many of
OptionButton4's have a True Value"... only one control on a UserForm can have the name OptionButton4; and, if you mean OptionButton4 is the GroupName you want to check, then only one control within that GroupName collection can be True at any given time. -- Rick (MVP - Excel) "Patrick C. Simonds" wrote in message ... 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
UserForm OptionButtons | Excel Discussion (Misc queries) | |||
c# & InterOp & OptionButtons | Excel Programming | |||
OptionButtons | Excel Programming | |||
Add OptionButtons in Excel | Excel Programming | |||
optionbuttons | Excel Programming |