I have a user defined function that i want to use in a custom data validation. My function is working properly but when i use it in data validation, it's every time in error...
There is the code:
Public Function AlphaNumeric(pValue) As Boolean
Dim LPos As Integer
Dim LChar As String
Dim LValid_Values As String
'Start at first character in value
LPos = 1
'Test each character in value
While LPos <= Len(pValue)
'Single character in value
LChar = Mid(pValue, LPos, 1)
'If character is not alphanumeric, return FALSE
If InStr(REFALPHACHAR, LChar) = 0 Then
AlphaNumeric = False
Exit Function
End If
'Increment counter
LPos = LPos + 1
Wend
'Value is alphanumeric, return TRUE
AlphaNumeric = True
End Function
And the setting of my data validation:
