View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Darren Hill[_2_] Darren Hill[_2_] is offline
external usenet poster
 
Posts: 80
Default Drop Down box displays only first list item

I had a problem with Dropdown boxes which Dave Peterson and Kevin Beckham
helped me with (thanks, guys!), but now another problem has arisen.

I have a drop down (Forms tolbar) in Column A which sets the fill range of a
dropdown in Column C, the code for this is shown below.
But the displayed text in the ColumnC drop down is always "(none)" which
happens to be the first item in each of the possible fill ranges.

I can select a value in this drop down, and the proper value is entered in
the linked cell, but the text displayed in the drop down box is always
"(none)". Can anyne tell me what is going wrong?

(The code for the listfillrange transfer is shown in full below in case it
is the culprit)
Darren





--------The Full Code-------

Sub ChangeDropDownC()
'From Dave Peterson and Kevin Beckham

Dim ColB_DD As DropDown
Dim ColA_DD As DropDown
Dim strCaller As String
Dim strFillRange As String
Dim intLink As Integer

'will return the name of the responsible drop-down
strCaller = Application.Caller()
With ActiveSheet.Shapes(strCaller)
intLink = .ControlFormat.Value
End With

Set ColA_DD = ActiveSheet.DropDowns(strCaller)
strCaller = Replace(strCaller, "A", "C")
Set ColB_DD = ActiveSheet.DropDowns(strCaller)

ColB_DD.ListIndex = 0 'empty it

intLink = Application.WorksheetFunction.Index _
(Range("List_OutfitTypes"), intLink)

If intLink -1 Then
ColB_DD.ListFillRange =
Worksheets("GarmentsByType").Range("GarmentByType" ). _
Offset(0, intLink).Resize(8, 1).Address(external:=True)
Else
ColB_DD.ListFillRange =
Worksheets("GarmentsByType").Range("GarmentByType" ). _
Resize(1, 1).Address(external:=True)
End If

ColB_DD.ListIndex = 1


End Sub