Requirement:
The user has a Userform that has multiple textboxes, comboboxes, and labels.
The user is attempting to do for this part is to look at a sheet Value, 2 comboboxes and a text box.
The user would like to make it do in plain terms is: "If combobox1 says "Small" AND combobox2 says "Wash", get the value of cell E1 from the sheet named "DATA", and calculate it with the input of textbox1. so if the condition are met, "Small" and "Wash" then $30 X 1 =$30. Respectively me.cbsize, me.cbservice, E1 .value, me.tbQty, Me.lblPrice1.
Solution:
Private Sub cbsize_Change() Call Price End Sub Private Sub cbservice_Change() Call Price End Sub Private Sub tbQty_AfterUpdate() Call Price End Sub Private Sub Price() If cbsize = "Small" And cbservice = "Wash" And tbQty <> "" Then lblprice.Caption = "$" & Format(Sheets("DATA").[e1] * CDbl(tbQty), "0.00") Else lblprice.Caption ="" End If End Sub
Obtained from the OzGrid Help Forum.
Solution provided by KjBox.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
How to vertically centre text in userform label |
How to select an option in the combobox and the textboxes to auto-fill with data |
How to make all empty textboxes invisible |
How to search ListBox as the user types in TextBox |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.