!...Below Code to
Create User Defined Function in Excel....!
Use:- To extract Alphabets
Function EXTRACT_ALPHA(str) As Variant
Dim i As Integer
Dim char, alpa As Variant
char = ""
For i = 1 To Len(WorksheetFunction.Trim(str))
alpha = Mid(str, i, 1)
If IsNumeric(alpha) = True Or Asc(UCase(alpha)) > 0 And Asc(UCase(alpha)) < 65 Or Asc(UCase(alpha)) > 90 Or (alpha) = " " Then
Else
char = char & alpha
End If
Next
EXTRACT_ALPHA = char
End Function
_____________________________________
Example:-
=EXTRACT_ALPHA ("^&&5**111CDFG8899B$$$$$_~%^*")
Result--------------------------------->CDFGB
Dim i As Integer
Dim char, alpa As Variant
char = ""
For i = 1 To Len(WorksheetFunction.Trim(str))
alpha = Mid(str, i, 1)
If IsNumeric(alpha) = True Or Asc(UCase(alpha)) > 0 And Asc(UCase(alpha)) < 65 Or Asc(UCase(alpha)) > 90 Or (alpha) = " " Then
Else
char = char & alpha
End If
Next
EXTRACT_ALPHA = char
End Function
Example:-
=EXTRACT_ALPHA ("^&&5**111CDFG8899B$$$$$_~%^*")
No comments:
Post a Comment