Dim ferme As Boolean 'mémorise la variable
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("f6:f15")) Is Nothing Then
Cancel = True
With Combo1
.List = Array("Métropole 33", "988 Nouvelle-Calédonie 687", "987 Polynésie française 689", _
"974 La Réunion 262", "973 Guyane 594", "972 Martinique 596", "971 Guadeloupe 590")
.Left = Target.Offset(, 1).Left '<-- position horizontale
.Top = Target.Top '<-- position verticale
.Width = 202 '<-- largeur
.Height = 1 '<-- hauteur, pour masquer la zone de texte
.Text = "" 'pour mettre le 1er élément en surbrillance
.Visible = True
Do
DoEvents
If ferme Then End 'arrête tout
Target.Offset(, -5).Select 'déplace la sélection en colonne A mais est-ce bien utile ???
.DropDown
Loop
End With
End If
End Sub
Private Sub Combo1_Change()
If Not Combo1.MatchFound Then Exit Sub
Dim x$
ActiveCell(1, 6) = Right$(Combo1.Text, 3) & Right$(ActiveCell(1, 6), 9)
x = ActiveCell(1, 2) 'colonne B
x = Replace(Replace(x, " - Métropole", ""), " - Outre Mer", "")
Application.EnableEvents = False 'si c'est vraiment nécessaire...
ActiveCell(1, 2) = x & IIf(Left(ActiveCell(1, 6), 2) = "33", " - Métropole", " - Outre Mer")
Application.EnableEvents = True
ferme = True 'arrête la boucle Do/Loop
End Sub