Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'Empêche les espaces
If KeyAscii = 32 Then
KeyAscii = 0
MsgBox "Espaces interdits !"
End If
'Empêche les chiffres
If KeyAscii > 47 And KeyAscii < 58 Then
KeyAscii = 0
MsgBox "Chiffres interdits !"
End If
'Empêche les majuscules
If KeyAscii > 64 And KeyAscii < 91 Then
KeyAscii = 0
MsgBox "Majuscules interdites !"
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 32, 48 To 57, 65 To 90
KeyAscii = 0
MsgBox "Caractères interdits !"
End Select
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 32, 48 To 57, 65 To 90, 97 To 122
KeyAscii = 0
MsgBox "Caractères interdits !"
End Select
End Sub
Sub test_chr()
Dim i&
For i = 32 To 122
Select Case i
Case 32, 48 To 57, 65 To 90, 97 To 122
Cells(i, 1) = Chr(i)
Cells(i, 2) = Asc(Cells(i, 1))
End Select
Next i
Columns("A:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
Sub test_chr_formules()
With ActiveSheet
With .Cells(1, 1).Resize(255, 1)
.Formula = "=ROW()": .Value = .Value
End With
.Cells(1, 2).Resize(255, 1).FormulaR1C1 = "=CHAR(RC[-1])"
.Cells(1, 3).Resize(255, 1).FormulaR1C1 = "=CODE(RC[-1])"
.Range("A1:A31,A33:A47,A58:A64,A91:A96,A123:A255").EntireRow.Delete
End With
End Sub