Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim f$, s
On Error Resume Next
f = ActiveCell.Validation.Formula1
With ListBox1
.Visible = False
If Not (f Like "=NB.SI(*" Or f Like "=COUNTIF(*") Then Exit Sub
s = Split(f, ";")
If UBound(s) < 1 Then s = Split(f, ",") 'pour version anglaise
f = Mid(s(0), InStr(s(0), "(") + 1)
.LinkedCell = ActiveCell.Address(0, 0)
.ListFillRange = f
Application.ScreenUpdating = False
Range(f).Columns.AutoFit 'ajustement largeur
.ColumnWidths = Range(f).Width 'adapter éventuellement
.Width = Range(f).Width + 8 'adapter éventuellement
.Height = Range(f).Height + 4 'adapter éventuellement
Range(f).Columns.Hidden = True 'masque la colonne
.Top = ActiveCell.Top
.Left = ActiveCell(1, 2).Left
.Visible = True
End With
End Sub
Private Sub Listbox1_Click()
With ActiveCell
'ici le code à adapter
.Activate 'ôte le focus
End With
End Sub