Select Case Statements
Try something like this:
1) Use a naming convention for the option buttons
Example: All width settings optionbuttons begin with "optW"
2)Enter the width value in the TAG property of those option buttons
Example: optW20 would have a TAG property set to: 20
3) Use this kind of code the harvest the MWidth value:
'--------Start of Code----------
Dim oCtrl As Control
Dim MWidth
For Each oCtrl In UserForm1.Controls
If UCase(Left(oCtrl.Name, 4)) = "OPTW" Then
If oCtrl.Value = True Then
MWidth = oCtrl.Tag
Exit For
End If
End If
Next oCtrl
'--------End of Code----------
Is that something you can work with?
***********
Regards,
Ron
XL2002, WinXP
"Al@n" wrote:
Hi
I have a dialog box in which there are a number of frames(fraMWidth)
containing option buttons. I'm trying to use Select Case statements to
define values dependant on which option button is chosen. I'm struggling
with the code and would appreciate any assistance.
A snippet of code so far is:
Dim MWidth as integer
Select Case fraMWidth.Control.Value
Case optW20 = True
MWidth = 20
Case optW16 = True
MWidth = 16
Case optW12 = True
MWidth = 12
Case optW10 = True
MWidth = 10
Case optW8 = True
MWidth = 8
Case optWOther = True
MWidth = txtWOther.Value
End Select
TIA
--
Al@n
|