Ladyj205
05-01-2018, 09:44 AM
I have MS Office 2010
I have 4 optionbuttons and each has there own value such as:
optionbutton 3 is 75
optionbutton 2 is 50
optionbutton 1 is 25
optionbutton 0 is 0
is there a vba for having one sub instead of having multiple sub.
here is my code that i have now:
Option Explicit
Private Sub OptionButton0_Click()
If OptionButton0 Then
Range("D44").Value = 0
End If
End Sub
Private Sub OptionButton1_Click()
If OptionButton1 Then
Range("D44").Value = 25
End If
End Sub
Private Sub OptionButton2_Click()
If OptionButton2 Then
Range("D44").Value = 50
End If
End Sub
Private Sub OptionButton3_Click()
If OptionButton3 Then
Range("D44").Value = 75
End If
End Sub
i want to go for something like this
Sub CalcDisplay()
Dim arrParts() As Variant
Select Case True
Case Opt_1_3: .Text = "75"
Case Opt_1_2: .Text = "50"
Case Opt_1_1: .Text = "25"
Case Opt_1_0: .Text = "0"
End Select
any examples and help would be greatly appreciated. : pray2: Thanks
I have 4 optionbuttons and each has there own value such as:
optionbutton 3 is 75
optionbutton 2 is 50
optionbutton 1 is 25
optionbutton 0 is 0
is there a vba for having one sub instead of having multiple sub.
here is my code that i have now:
Option Explicit
Private Sub OptionButton0_Click()
If OptionButton0 Then
Range("D44").Value = 0
End If
End Sub
Private Sub OptionButton1_Click()
If OptionButton1 Then
Range("D44").Value = 25
End If
End Sub
Private Sub OptionButton2_Click()
If OptionButton2 Then
Range("D44").Value = 50
End If
End Sub
Private Sub OptionButton3_Click()
If OptionButton3 Then
Range("D44").Value = 75
End If
End Sub
i want to go for something like this
Sub CalcDisplay()
Dim arrParts() As Variant
Select Case True
Case Opt_1_3: .Text = "75"
Case Opt_1_2: .Text = "50"
Case Opt_1_1: .Text = "25"
Case Opt_1_0: .Text = "0"
End Select
any examples and help would be greatly appreciated. : pray2: Thanks