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
|
Dim MyDD
Sub MaSelection()
On Error GoTo Fin
Debug.Print MyDD
Range(MyDD.LinkedCell) = Range(MyDD.ListFillRange).Cells(MyDD)
MyDD.Delete
Fin:
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
If Not MyDD Is Nothing Then MyDD.Delete
On Error GoTo 0
If Target.Column <> 2 Then Exit Sub
If Target.Cells.Count = 1 Then
Debug.Print Target.Left
Debug.Print Target.Top
Debug.Print Target.Height
Debug.Print Target.Width
Set MyDD = ActiveSheet.DropDowns.Add(Target.Left, Target.Top, Target.Width, Target.Height)
With MyDD
.ListFillRange = "Feuil1!$D$3:$D$7"
.Display3DShading = False
.OnAction = ThisWorkbook.Name & "!ThisWorkbook.MaSelection"
.LinkedCell = Target.Address
End With
End If
End Sub |
Partager