Segue código para extrair caracteres alfabéticos:
Function ExtAlpha (ByVal cell As String) As Object'This function will extract 1st continuous set of digits.
Dim i As Long, flag As Long
Let flag = 0Let ExtAlpha = ""For i = 1 To Len(cell)If (Asc(Mid(cell, i, 1)) >= 65 And Asc(Mid(cell, i, 1)) <= 90) Or (Asc(Mid(cell, i, 1)) >= 97 And Asc(Mid(cell, i, 1)) <= 122) ThenLet flag = 1Let ExtAlpha = ExtractAlpha & Mid(cell, i, 1)ElseIf flag = 1 Then Exit FunctionEnd IfNext iEnd Function
Tags: VBA, Text, User Defined Function (UDF), VBA Macro, caractere, alfabético
Nenhum comentário:
Postar um comentário