Salut treerrttyt,
Salut Dhany,
quelque chose comme ça ?
La macro démarre sur un double-clic dans la feuille.
Astuce : le mot "Faux" équivaut à une commande Annuler et termine l'encodage avec effacement de la feuille !
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'
Dim iRow%, sRep$
'
Cancel = True
Cells.Delete
Range("A1").Value = "MOTS"
'
Do
Do
sRep = Application.InputBox("Veuillez encoder un mot !", "Le poids des mots")
Loop Until Not IsNumeric(sRep) And sRep <> ""
If sRep = "Faux" Then
Cells.Delete
Exit Sub
Else
iRow = Range("A" & Rows.Count).End(xlUp).Row + 1
Range("A" & iRow).Value = WorksheetFunction.Proper(sRep)
If iRow > 2 And Range("A" & iRow).Value < Range("A" & iRow - 1).Value Then
Range("C1").Value = "Nombre de mots :"
Range("D1").Value = iRow - 1
Exit Do
End If
End If
Loop
Columns.AutoFit
UsedRange.Borders.LineStyle = xlContinuous
'
End Sub
A+