Thursday, January 12, 2012

User Defined Function in Excel to Extract Special Characters


!.....Below Code to Create User Defined Functions in Excel....!

Use:- To extract special characters

Function EXTRACT_SPECIAL_CHAR(str) As Variant Dim i As Integer

Dim spl, splchar As Variant
spl = ""
For i = 1 To Len(str)
splchar = Mid(str, i, 1)
If IsNumeric(splchar) = True Or Asc(UCase(splchar)) > 64 And Asc(UCase(splchar)) < 91 Or splchar = " " Then
Else
spl = spl & Mid(str, i, 1)
End If
Next
EXTRACT_SPECIAL_CHAR = spl

End Function

_________________________________________
Example:-
=EXTRACT_SPECIAL_CHAR("^&&5**111CDFG8899B$$$$$_~%^*")


Result------------->  ^&&**$$$$$_~%^*

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