Is it possible that case statement can be used in this line of codes
Private Sub txtQ1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If (KeyAscii = 49 And KeyAscii = 50) Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
MsgBox "Invalid Key Pressed, You Can Enter Numbers 1 and 2 Only"
End If
End Sub
Private Sub txtQ2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If (KeyAscii > 47 And KeyAscii < 58) Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
MsgBox "Invalid Key Pressed, You Can Enter Numbers Only"
End If
End Sub
Private Sub txtQ3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If (KeyAscii > 48 And KeyAscii < 55) Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
MsgBox "Invalid Key Pressed, You Can Enter Numbers Only"
End If
End Sub
Private Sub txtCy1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If (KeyAscii > 48 And KeyAscii < 55) Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
MsgBox "Invalid Key Pressed, You Can Enter Numbers Only"
End If
End Sub
.