Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 03-24-2019, 08:35 AM
gmaxey gmaxey is offline Loop through Multiple Boolean Variables Windows 10 Loop through Multiple Boolean Variables Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
Reply With Quote
 



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

Other Forums: Access Forums

All times are GMT -7. The time now is 01:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft