Sub ColonnesEnCm()
Dim cm As Single, points As Single, savewidth As Single
Dim count As Single
Application.ScreenUpdating = False
cm = Application.InputBox ("Largeur de la colonne en cm.", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints (cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "La largeur de" & cm & "est trop large" & Chr(10) & _
"la valeur maxi est de " & _
Format (ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOkOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
ipwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub