Dim a(), f
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set f = Sheets("BASE")
If Not Intersect(Range("A3:A30,C3:C30"), Target) Is Nothing And Target.Count = 1 Then
a = Application.Transpose(f.Range("A2:A" & f.[A65000].End(xlUp).Row))
Me.ComboBox1.List = a
Me.ComboBox1.Height = Target.Height + 3
Me.ComboBox1.Width = Target.Width
Me.ComboBox1.Top = Target.Top
Me.ComboBox1.Left = Target.Left
Me.ComboBox1 = Target
Me.ComboBox1.Visible = True
Me.ComboBox1.Activate
Else
Me.ComboBox1.Visible = False
End If
If Not Intersect(Range("B3:B30,D3:D30"), Target) Is Nothing And Target.Count = 1 Then
a = Application.Transpose(f.Range("C2:C" & f.[C65000].End(xlUp).Row))
Me.ComboBox2.List = a
Me.ComboBox2.Height = Target.Height + 3
Me.ComboBox2.Width = Target.Width
Me.ComboBox2.Top = Target.Top
Me.ComboBox2.Left = Target.Left
Me.ComboBox2 = Target
Me.ComboBox2.Visible = True
Me.ComboBox2.Activate
Else
Me.ComboBox2.Visible = False
End If
End Sub
Private Sub ComboBox1_Change()
ActiveCell.Value = Me.ComboBox1
End Sub
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
ActiveCell.Offset(1).Select
End If
End Sub
Private Sub ComboBox2_Change()
ActiveCell.Value = Me.ComboBox2
End Sub