Code:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not fcnValidate(TextBox1, "Number") Then
Cancel = True
End If
End Sub
Function fcnValidate(oCtrl As Control, strValType As String) As Boolean
fcnValidate = True
Select Case strValType
Case "Number"
If Not IsNumeric(oCtrl.Text) Then
MsgBox ("Must be a Number")
With oCtrl
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
fcnValidate = False
Else
oCtrl.BackColor = vbWhite
End If
Case "Text"
End Select
End Function