Menuへ
テキストボックスに整数のみ入力




シートコード
コマンドボタンクリックイベント
'テキストボックス キー入力イベント
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    KeyAscii = KeyInputVal(KeyAscii)
End Sub
標準モジュールコード
'整数のみ入力
Public Function KeyInputVal(Key) As Integer
    If Key <> 8 Then
        If (Key < 48 Or Key > 57) Then
            Key = 0
        End If
    End If
    KeyInputVal = Key
End Function



Topへ