1 Attachment(s)
Multiple textboxes that only accepts numeric value
Hello! I just want to ask, is there a way for me to have multiple text boxes that only accept numeric value?
So, the picture below is from my UserForm
Attachment 27796
This is the code I use for validation in which I must replicate per textbox.
Code:
Private Sub tb_mtb_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Not IsNumeric(tb_mtb.Value) Then
MsgBox "Only numbers allowed!", vbOKOnly + vbCritical, "Title"
tb_mtb.Value = ""
End If
End Sub
Private Sub tb_fil_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Not IsNumeric(tb_fil.Value) Then
MsgBox "Only numbers allowed!", vbOKOnly + vbCritical, "Title"
tb_fil.Value = ""
End If
End Sub