I have declared/grouped all pertinent 22 option buttons in userform_initialize() as
OptB1.Groupname = "Product"
OptB2.Groupname = "Product"
...
OptB22.Groupname = "Product"
I added the module code and it looks like this now
Dim c As Control
For Each c In Controls
If TypeName(c) = "OptionButton" Then
If c.GroupName = Product Then
If c.Value Then
SelectedOptionButton = c.Caption
Exit Function
End If
End If
End If
Next c
I placed the evaluate code in the textbox_change() where the calculated value should be displayed
the code is:
Private Sub TBoxMic_Change()
Const GroupName = Product
Evaluate ("IF(XOR(13>=" & TBoxBlend.Value & "," & TBoxBlend.Value & "="""")," & "((" & TBoxBlend.Value & "-(VLOOKUP(" & SelectedOptionButton(Product) & ",DATA!$D$1:$E$22,2,0)))*100)*0.02," & "IF(" & TBoxBlend.Product & ">=14," & "((((" & TBoxBlend.Value & "-(VLOOKUP(" & SelectedOptionButton(Product) & ",DATA!$D$1:$E$22,2,0))))*10)*0.02)," & """""" & ")")
End Sub
The only issue is that it is not displaying the value in TBoxMic; I do have a command button I could place this code in but it seems it is missing some code to add the resulting value to TBoxMic
Note: In the module code I added the word "Option" to change the code
Dim c As Control
For Each c In Controls
If TypeName(c) = "OptionButton" Then
If c.GroupName = GroupName Then
If c.Value Then
SelectedButton = c.Caption
Exit Function
End If
End If
End If
Next c
to
Dim c As Control
For Each c In Controls
If TypeName(c) = "OptionButton" Then
If c.GroupName = Product Then
If c.Value Then
SelectedOptionButton = c.Caption
Exit Function
End If
End If
End If
Next c
I currently have the evaluate code in the SelectedOptionButton_Click()
and everything is compiling without a sub undefined error; however, as mentioned, I need the piece to place the value
Something like TBoxMic = Evaluate.Value??
Best Regards,
Jon
Bookmarks