Microsoft
Software
Hardware
Network
Question : VBA Excel User Form Input Validation
Hi All,
I am developing a simple forms based application in excel and am having a few problems with user input validation.
My code is working fine when checking for instances of Null but when the user enters a ] \ character, my code crashes with a Type Mismatch error.
Is anyone out here able to help me nail this once and for all?
My current source code for the On_Change event is as follows:
Private Sub RearAislewayDistance_Chang
e()
'Checking to see if user has entered data correctly.
If IsNumeric(Me.RearAislewayD
istance) Then
If Me.RearAislewayDistance = "" Or IsNull(Me.RearAislewayDist
ance) Then
MsgBox "Please provide total number of pallets shipped per week.", vbCritical
Me.RearAislewayDistance.Se
tFocus
Me.RearAislewayDistance.Ba
ckColor = vbRed
Me.RearAislewayDistance.Fo
reColor = &HFFFFFF
Exit Sub
Else
Me.RearAislewayDistance.Ba
ckColor = &H6FFFFF
Me.RearAislewayDistance.Fo
reColor = &H80000012
Me.RearAislewayDistance.Va
lue = FormatNumber(Me.RearAislew
ayDistance
, 0)
End If
End If
End Sub
Answer : VBA Excel User Form Input Validation
Try the Load Optimized Defaults first., If that doesn't work try the other one. Good luck.
Random Solutions
How do I add a due date column, and sort by the document date in AR Statements?
How many database instance that can be supported by SQL Server 2008 Standard Edition?
obtain source (/usr/src) for 8.0-RELEASE-p3
Counting number of days between two dates using C#
Column Name in query
How can I prevent changes to web browser proxy settings?
PXE-E55: ProxyDHCP service did not reply to request on port 4011 Using SCCM 2007
How can i setup IIS on windows server 2008
How do I lookup and insert the foreign key value into a table when passing a variable value from different column in the related table?
PHP calling URL (which domain got me here?) PATH_INFO?