[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Dim[/color] CloseForm [color=darkblue]As[/color] [color=darkblue]Boolean[/color]
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] ComboBox1_Exit([color=darkblue]ByVal[/color] Cancel [color=darkblue]As[/color] MSForms.ReturnBoolean)
[color=darkblue]Dim[/color] vData [color=darkblue]As[/color] [color=darkblue]Variant[/color]
[color=darkblue]Dim[/color] rFoundCell [color=darkblue]As[/color] Range
[color=darkblue]Dim[/color] SearchTerm [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]If[/color] CloseForm = [color=darkblue]True[/color] [color=darkblue]Then[/color] [color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
[color=darkblue]If[/color] Me.ComboBox1.Value = "" [color=darkblue]Then[/color]
MsgBox "Please enter or select a value for ComboBox1...", vbExclamation
Cancel = [color=darkblue]True[/color]
[color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
SearchTerm = Me.ComboBox1.Value
[color=darkblue]Set[/color] rFoundCell = Columns("B").Find(SearchTerm, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
[color=darkblue]If[/color] rFoundCell [color=darkblue]Is[/color] [color=darkblue]Nothing[/color] [color=darkblue]Then[/color]
MsgBox "Search term was not found...", vbExclamation
[color=darkblue]With[/color] Me.ComboBox1
.SelStart = 0
.SelLength = Len(.Value)
[color=darkblue]End[/color] [color=darkblue]With[/color]
Cancel = [color=darkblue]True[/color]
[color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]If[/color] rFoundCell.Offset(2, 1) <> "" [color=darkblue]Then[/color]
vData = Range(rFoundCell.Offset(1, 1), rFoundCell.Offset(1, 1).End(xlDown))
Me.ComboBox2.List = vData
[color=darkblue]Else[/color]
[color=darkblue]With[/color] Me.ComboBox2
.Clear
.AddItem rFoundCell.Offset(1, 1).Value
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] UserForm_QueryClose(Cancel [color=darkblue]As[/color] [color=darkblue]Integer[/color], CloseMode [color=darkblue]As[/color] [color=darkblue]Integer[/color])
If CloseMode = 0 [color=darkblue]Then[/color] CloseForm = [color=darkblue]True[/color]
End [color=darkblue]Sub[/color]
[/font]