![]() |
|
#8
|
|||
|
|||
|
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
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Generate template-based letter with multiple variables | shallaes | Word VBA | 5 | 07-12-2018 12:18 AM |
| Multiple Problems with a loop | Radtastic10 | Excel Programming | 3 | 06-09-2017 09:38 AM |
| Testing multiple values of two independant variables and charting results | sgcannon | Excel | 0 | 10-20-2015 10:10 AM |
| Array to iterate through variables and trap blank variables | Marrick13 | Word VBA | 5 | 08-04-2015 06:19 AM |
| Same values of variables in word add-in are being shared across multiple document | naq.abbas@gmail.com | Word | 0 | 01-13-2014 10:41 AM |