Option Explicit
Private Dic As Dictionary ' Cochez la référence Microsoft Scripting Runtime
Sub EffaceDic()
Set Dic = Nothing
End Sub
Function Selon1erMot(ByVal Texte As String, ByVal RngTab As Range) As String
Dim Td(), L As Long, C As Long, Ts() As String, P As Long
Ts = Split(UCase(Texte))
If Dic Is Nothing Then
Set Dic = New Dictionary
Td = RngTab.Value
For L = 1 To UBound(Td, 1)
For C = 2 To UBound(Td, 2)
If IsEmpty(Td(L, C)) Then Exit For
Dic(UCase(Td(L, C))) = Td(L, 1): Next C, L: End If
For P = 0 To UBound(Ts)
If Dic.Exists(Ts(P)) Then Exit For
Next P
If P <= UBound(Ts) Then Selon1erMot = Dic(Ts(P))
End Function