Hi again.
Where an how is the best way to validate an input?
I mean, i want a cell / col that only allows numbers.
following your example, i used:
Code:Private Sub Gr1_EditSetupStyle(dwStyle As Long, dwExStyle As Long) Const ES_NUMBER As Long = &H2000 Select Case Gr1.EditCol Case 3 'solo numeros dwStyle = dwStyle Or ES_NUMBER End Select End Sub
But with this, i can't enter decimals ('.' or ',')
Maybe I must check all the keypress at cell ?, is there another Constant that allows numbers and decimals ?
Thanks!
Edit:
Solved this way (I accept better ways to do it xD):
Code:Private Sub Gr1_EditKeyPress(KeyChar As Integer) If InStr("all the keys of the columns i want to check", Gr1.ColKey(Gr1.EditCol)) >= 1 Then If Not (KeyChar >= vbKeyA And KeyChar <= vbKeyZ) And Not (KeyChar >= 97 And KeyChar <= 122) Then Else KeyChar = 0 End If End If End Sub




Reply With Quote