Extraer Letras y/o Números de valores alfanuméricos en Excel
Código
Function IB·ExtraerLetraNumero(Texto As String, Optional ByVal Ingrese1paraObtenerLosNumeros As String = "0") As String
Dim x As String, I As Integer, c As Integer
For I = 1 To Len(Texto)
c = Asc(Mid(Texto, I, 1))
If Ingrese1paraObtenerLosNumeros = "1" Then
If c >= 48 And c <= 57 Then
x = x & Mid(Texto, I, 1)
End If
Else
Select Case c
Case 193, 201, 205, 211, 218, 209, 225, 233, 237, 243, 250, 241
x = x & Mid(Texto, I, 1)
Case 65 To 90, 97 To 122
x = x & Chr(c)
End Select
End If
Next I
IB·ExtraerLetraNumero = x
End Function
Comentarios
Publicar un comentario