Thursday, January 12, 2012

User Defined Function in Excel to Extract Alphabets


!...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

No comments:

Post a Comment

Excel VBA to send email from excel with HTML table in a email body

'' Excel vba script to send email from outlook & email body in HTML table format. ''Write down email body in HTML tags...