Ps Igual y ya esta demas hacer esto pero lo bueno es que hace varias cosas
Escribir solo mayusculas, Escribir solo minusculas, numeros enteros, decimales, negativos, que no se pueda escribir, ademas de poner limite de decimales
Ojala y sirva
Public Const sNumeros = "0123456789"
Public Const sLetras = "abcdefghijklmnopqrstuvwxyz"
Public Const sDecimal = "."
Public Const sNegativo = "-"
Public Const SEspecial = ","
Function Valida_Texto(sTexto As String, KeyAscii As Integer, sValidaCadena As String, Optional May0_Min1_Nor2 As Integer = 2, Optional Editable As Boolean = True, Optional bDecimal As Boolean = False, Optional bNegativo As Boolean = False, Optional NoDecimales = 2) As Integer
Dim x As Integer
Dim s As String
If KeyAscii >= 32 Then
If Editable = True Then
If InStr(1, UCase(sValidaCadena) & LCase(sValidaCadena), Chr(KeyAscii)) <> 0 Then
Select Case May0_Min1_Nor2
Case 0
Valida_Texto = Asc(UCase$(Chr(KeyAscii)))
Case 1
Valida_Texto = Asc(LCase$(Chr(KeyAscii)))
Case 2
Valida_Texto = KeyAscii
End Select
Else
Valida_Texto = 0
End If
Else
Valida_Texto = 0
End If
If bDecimal = True Then
If InStr(1, sTexto, ".") <> 0 Then
If KeyAscii = Asc(".") Then
Valida_Texto = 0
Else
s = sTexto & Chr(KeyAscii)
x = InStr(1, s, ".")
s = Mid(s, x + 1, Len(s) - x)
If Len(s) > NoDecimales Then
Valida_Texto = 0
Else
Valida_Texto = KeyAscii
End If
End If
End If
End If
If bNegativo = True Then
If Len(sTexto) = 0 Then
If KeyAscii = Asc("-") Then
Valida_Texto = Asc("-")
End If
End If
End If
Else
If Editable = True Then
Valida_Texto = KeyAscii
Else
Valida_Texto = 0
End If
End If
End Function