1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveWorkbook.Names.Add Name:="zsaisie1", RefersTo:=Range("A2:A16")
ActiveWorkbook.Names.Add Name:="zsaisie2", RefersTo:=Range("C2:C16")
If Not Intersect(Union([zsaisie1], [zsaisie2]), Target) Is Nothing And Target.Count = 1 Then
UserForm1.Left = Target.Left + 150
UserForm1.Top = Target.Top + 90 - Cells(ActiveWindow.ScrollRow, 1).Top
UserForm1.Show
End If
End Sub
formulaire
Dim a()
Private Sub UserForm_Initialize()
If Not Intersect([zsaisie1], ActiveCell) Is Nothing Then a = [liste1].Value
If Not Intersect([zsaisie2], ActiveCell) Is Nothing Then a = [liste2].Value
Me.ComboBox1.List = a
End Sub
Private Sub ComboBox1_Change()
Set d1 = CreateObject("Scripting.Dictionary")
tmp = UCase(Me.ComboBox1) & "*"
For Each c In a
If UCase(c) Like tmp Then d1(c) = ""
Next c
Me.ComboBox1.List = d1.keys
Me.ComboBox1.DropDown
End Sub
Private Sub ComboBox1_Click()
ActiveCell = Me.ComboBox1
Unload Me
End Sub |
Partager