'「1-9」[.]以外の入力はじき、5桁以上は入力不可 If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> vbKeyBack And KeyAscii <> vbKeyDelete Or _ (Len(Text1.Text) >= 4 And KeyAscii <> vbKeyBack And KeyAscii <> vbKeyDelete) Then KeyAscii = 0 Else '全角を半角に変換する KeyAscii = Asc(StrConv(Chr$(KeyAscii), vbNarrow)) End If End Sub