View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Grouped option buttons on forms

Maybe...

Dim o As Control
drngPied.Show
For Each o In drngPied.Controls
If TypeOf o Is MSForms.OptionButton Then
If o.GroupName = "SizeOptions" And o.Value = -1 Then
sSize = c.Name
End If
End If
Next o



wrote:

On Feb 12, 2:58 pm, "merjet" wrote:
Dim c As Control
Dim x As Integer
For Each c In UserForm1.Controls
If c.GroupName = "Season" And c.Value = True Then
x = Right(c.Name, Len(c.Name) - 12)
End If
Next c

Hth,
Merjet


I spoke too soon....I want to check each by GroupName and Value, but
c.GroupName is not valid. Only OptionButtons have GroupNames,
controls do not. So I tried:

Dim o As OptionButton

DrngPied.Show 'DrngPied is the form

For Each o In DrngPied.Controls
If o.GroupName = "SizeOptions" And o.Value = -1 Then
sSize = c.Name
End If
Next o

but I get a Type Mismatch at the For Each line.

John


--

Dave Peterson