Asignar un valor a una opción de Combobox en VBA
Resuelto
vils
-
vils29 -
vils29 -
Bonjour,
I'm requesting your help as I am currently stuck. I am trying to assign a value based on the selection of the ComboBox.
A1
Plywood 4€
Solid Wood 2€
It should be that when I select one of the options in my ComboBox (which takes the values from column A1), the price corresponds to that choice during the calculation.
I want the price to depend on the selection in the ComboBox.
I could add the price manually, but I would like the program to be modifiable (to change the actions and prices, or to add more).
Currently, I have this for initializing 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 get all the values present in column A into my ComboBox.
In my calculations, I am trying to get the cost of a surface area, length=textbox1, width=textbox2, price per m²=combobox1
priceSurface = textbox1 * textbox2 * combobox1 (but I want the price and not the text)
Thank you for reading, and I hope you can solve my problem.
I'm requesting your help as I am currently stuck. I am trying to assign a value based on the selection of the ComboBox.
A1
Plywood 4€
Solid Wood 2€
It should be that when I select one of the options in my ComboBox (which takes the values from column A1), the price corresponds to that choice during the calculation.
I want the price to depend on the selection in the ComboBox.
I could add the price manually, but I would like the program to be modifiable (to change the actions and prices, or to add more).
Currently, I have this for initializing 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 get all the values present in column A into my ComboBox.
In my calculations, I am trying to get the cost of a surface area, length=textbox1, width=textbox2, price per m²=combobox1
priceSurface = textbox1 * textbox2 * combobox1 (but I want the price and not the text)
Thank you for reading, and I hope you can solve my problem.