faeter87
10-04-2011, 02:11 PM
Hi
I'm trying to assign values to the different items in my combobox.
The idea is that the 3 input cells combined with a fourth value from the combobox can be used to calculate the "result".
This is what I've come up with so far, but obviously it's incorrect.
Can anyone please give me some pointers?
Sub Material()
With Range("C8")
Set Comb = ActiveSheet.DropDowns.Add(.Left, .Top, .Width, .Height)
End With
With Comb
.AddItem "material1"
.AddItem "material2"
.AddItem "material3"
End With
material1 = 210000
material2 = 27000
material3 = 3000
q = Range("C6").Value
L = Range("C4").Value
I = Range("C5").Value
w = ((5 * q * L) / (384 * I))
Select Case Comb
Case "material1"
Range("C10").Value = (w / material1)
Case "material2"
Range("C10").Value = (w / material2)
Case "material3"
Range("C10").Value = (w / material3)
End Select
End Sub
I'm trying to assign values to the different items in my combobox.
The idea is that the 3 input cells combined with a fourth value from the combobox can be used to calculate the "result".
This is what I've come up with so far, but obviously it's incorrect.
Can anyone please give me some pointers?
Sub Material()
With Range("C8")
Set Comb = ActiveSheet.DropDowns.Add(.Left, .Top, .Width, .Height)
End With
With Comb
.AddItem "material1"
.AddItem "material2"
.AddItem "material3"
End With
material1 = 210000
material2 = 27000
material3 = 3000
q = Range("C6").Value
L = Range("C4").Value
I = Range("C5").Value
w = ((5 * q * L) / (384 * I))
Select Case Comb
Case "material1"
Range("C10").Value = (w / material1)
Case "material2"
Range("C10").Value = (w / material2)
Case "material3"
Range("C10").Value = (w / material3)
End Select
End Sub