View Full Version : Yes/No combo box
da_phat
10-12-2006, 09:07 AM
can anyone help me.i need when a combo box with value "yes/no" will calculate a field.Example is when i chose "yes" it will calculate 10% from the a price if the user choose "no" then no percentage reduction.This have to be done in userform.thx
Jacob Hilderbrand
10-12-2006, 09:41 AM
You can make the ComboBox with a Rowsource that has Yes, and No, or you can use ComboBox1.AddItem "Yes" for example.
Then you just need to check the value of this on the change event for the ComboBox.
Option Explicit
Private Sub ComboBox1_Change()
If Me.ComboBox1.Text = "Yes" Then
Me.TextBox2.Value = Val(Me.TextBox1.Value) * 0.9
Else
Me.TextBox2.Value = Val(Me.TextBox1.Value)
End If
End Sub
Private Sub UserForm_Initialize()
Me.ComboBox1.AddItem "Yes"
Me.ComboBox1.AddItem "No"
End Sub
See Attachment
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.