Hi,
I just realized it was my mistake. I have just tried this code and it does work.
I changed the example a little bit to make sure international users can take advantage of it.
Cheers !
Sub AddDropDown(Target As Range)
Dim ddBox As DropDown
Dim vaProducts As Variant
Dim i As Integer
Dim streamSheet As Worksheet
Set streamSheet = Worksheets(2)
vaProducts = Array("Water", "Oil", "Chemicals", "Gas")
Set ddBox = streamSheet.DropDowns.Add(Target.Left, Target.Top, Target.Width, Target.Height)
With ddBox
.OnAction = "EnterProdinfo"
For i = LBound(vaProducts) To UBound(vaProducts)
.AddItem vaProducts(i)
Next i
End With
End Sub
Private Sub EnterProdInfo()
Dim vaPrices As Variant
Dim streamSheet As Worksheet
Set streamSheet = Worksheets(2)
vaPrices = Array(15, 12.5, 20, 18)
With streamSheet.DropDowns(Application.Caller)
.TopLeftCell.Value = .List(.ListIndex)
.TopLeftCell.Offset(0, 2).Value = vaPrices(.ListIndex - Array(0, 1)(1))
.Delete
End With
End Sub
|