Assign a value to a VBA Combobox choice
Solved
vils
-
vils29 -
vils29 -
Hello,
I am seeking your help as I am currently stuck; I need to assign a value based on the selection from the ComboBox.
A1
Plywood €4
Solid Wood €2
I need that when I select one of the options in my ComboBox (which takes values from column A1), the corresponding price is considered during the calculation.
I am looking to get the price based on the choice in the ComboBox.
I could manually add the price, but I want the program to be modifiable (to change actions and prices, or add new ones).
Currently, I have this for the initialization of my program:
VarDerLigne = Worksheets("parame").Range("A65536").End(xlUp).Row
VarPlage = Worksheets("parame").Range("A9:A" & VarDerLigne).Address
ComboBox1.RowSource = "parame!" & VarPlage
ComboBox1.ColumnHeads = False
ComboBox1.ListIndex = 0
This code allows me to obtain all the values present in column A into my ComboBox.
In my calculations, I seek to have the cost of a surface area, length=Textbox1, width=Textbox2, price per m²=ComboBox1
priceSurface = Textbox1 * Textbox2 * ComboBox1 (but I want to get the price, not the text)
Thank you for reading, and I hope you can solve my problem.
I am seeking your help as I am currently stuck; I need to assign a value based on the selection from the ComboBox.
A1
Plywood €4
Solid Wood €2
I need that when I select one of the options in my ComboBox (which takes values from column A1), the corresponding price is considered during the calculation.
I am looking to get the price based on the choice in the ComboBox.
I could manually add the price, but I want the program to be modifiable (to change actions and prices, or add new ones).
Currently, I have this for the initialization of my program:
VarDerLigne = Worksheets("parame").Range("A65536").End(xlUp).Row
VarPlage = Worksheets("parame").Range("A9:A" & VarDerLigne).Address
ComboBox1.RowSource = "parame!" & VarPlage
ComboBox1.ColumnHeads = False
ComboBox1.ListIndex = 0
This code allows me to obtain all the values present in column A into my ComboBox.
In my calculations, I seek to have the cost of a surface area, length=Textbox1, width=Textbox2, price per m²=ComboBox1
priceSurface = Textbox1 * Textbox2 * ComboBox1 (but I want to get the price, not the text)
Thank you for reading, and I hope you can solve my problem.