mthornburg
New Member
- Joined
- Jun 11, 2008
- Messages
- 8
Hi.
I'm currently building a form in Excel that has some questions only necessary if the user answers a certain way to previous ones (i.e. "If you said yes, then..."). I created a macro to disable and gray out the questions that the user does not need to fill out.
However, I was wondering if there was a more efficient way to do this than writing every single control's name out. All of the buttons above are grouped together with the Groupname being "Question9" . Is there a way to tell all of the buttons with a certain Groupname to do something instead of instructing each individually?
I looked all over for an answer to this. Thanks in advance.
Matt
I'm currently building a form in Excel that has some questions only necessary if the user answers a certain way to previous ones (i.e. "If you said yes, then..."). I created a macro to disable and gray out the questions that the user does not need to fill out.
Code:
Private Sub OptionButton33_Change()
If OptionButton33.Value = True Then
OptionButton34.Enabled = False
OptionButton34.ForeColor = SystemColorConstants.vbGrayText
OptionButton35.Enabled = False
OptionButton35.ForeColor = SystemColorConstants.vbGrayText
...
OptionButton44.Enabled = False
OptionButton44.ForeColor = SystemColorConstants.vbGrayText
OptionButton45.Enabled = False
OptionButton45.ForeColor = SystemColorConstants.vbGrayText
Else
OptionButton34.Enabled = True
OptionButton34.ForeColor = SystemColorConstants.vbWindowText
OptionButton35.Enabled = True
OptionButton35.ForeColor = SystemColorConstants.vbWindowText
...
OptionButton44.Enabled = True
OptionButton44.ForeColor = SystemColorConstants.vbWindowText
OptionButton45.Enabled = True
OptionButton45.ForeColor = SystemColorConstants.vbWindowText
End If
End Sub
I looked all over for an answer to this. Thanks in advance.
Matt