mahaveer
Member
I have 20 textbox on one user form and i have a command button now i want to add a code in command button like this:
If TextBox1.Value = "" Then
MsgBox "You must have to mention actual amount received in the month of Jan", vbInformation, "Amount Received"
Me.TextBox1.SetFocus
Exit Sub
Else
If Not IsNumeric(TextBox1) Then
MsgBox "Only numbers allowed", vbInformation, "Jan"
Me.TextBox1.Value = ""
Me.TextBox1.SetFocus
Exit Sub
End If
End If
But i think i have to write the same code 20 times with minor changes.
Is there any other option?
If TextBox1.Value = "" Then
MsgBox "You must have to mention actual amount received in the month of Jan", vbInformation, "Amount Received"
Me.TextBox1.SetFocus
Exit Sub
Else
If Not IsNumeric(TextBox1) Then
MsgBox "Only numbers allowed", vbInformation, "Jan"
Me.TextBox1.Value = ""
Me.TextBox1.SetFocus
Exit Sub
End If
End If
But i think i have to write the same code 20 times with minor changes.
Is there any other option?