Private Sub Worksheet_Change(ByVal Target As Range)
Dim v$, i&, j%
v = Cells(Target.Row, 2)
With [A1].CurrentRegion
.Sort [B1], xlAscending, Header:=xlYes 'tri
i = [B:B].Find(v, , xlValues, xlWhole).Row
j = Rows(i).Find("").Column 'colonne de la 1ère cellule vide de la ligne
Cells(i, IIf(j > .Columns.Count, Target.Column, j)).Select
'Test si en majuscules
If v <> UCase(v) Then Cells(Target.Row, 2) = UCase(v)
End With
End Sub