View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip[_3_] Chip[_3_] is offline
external usenet poster
 
Posts: 133
Default Add dropdown on an event.

I have some code which when a user double clicks on certain cells will
add a dropdown. The code is supposed to add the dropdown so its
dimensions match that of the target cell. While the actual dropdowns
have the correct length and width, and are placed correctly
horizontally, they are always off Vertically. Any ideas?



Sub adddropdown(Target As Range, typer As Integer)
Dim ddbox As DropDown
Dim vaproducts As Variant
Dim i As Integer
Dim skilllevel As Variant
Dim shift As Variant
shift = Array("1-Night", "2-Day", "3-Evening")
skilllevel = Array("RN", "LVN", "NA", "Other", "Traveler")
vaproducts = Array("Maternity Leave", "Workman's Comp", "Family
Leave", "Medical Leave", "Other")
c = Target.Address

'I HAVE CHECKED THE TARGET ADDRESS AND IT IS THE CORRECT CELL
'BUT THIS NEXT CODE WHERE IT ADDS THE DROPDOWN PUTS IT IN
'THE WRONG SPOT

With Target
Set ddbox = ActiveSheet.DropDowns.Add (.Left, .Top, .Width, .Height)
End With

With ddbox
..OnAction = "Enterlet"

Select Case typer
Case 1
For i = LBound(vaproducts) To UBound(vaproducts)
.AddItem vaproducts(i)
Next i
Case 2
For i = LBound(skilllevel) To UBound(skilllevel)
.AddItem skilllevel(i)
Next i
Case 3
For i = LBound(shift) To UBound(shift)
.AddItem shift(i)
Next i

End Select
End With
End Sub