Friday, January 13, 2012

User Defined function to Reverse a String

!....VBA program to Reverse a String.....!

Function String_Reverse(x) As String
String_Reverse = StrReverse(x)
End Function

Function Reverse_String(x) As Variant

Dim a, b As Variant
b = ""
While Len(x) > 0
a = Right(x, 1)
x = Left(x, Len(x) - Len(a))
b = b & a
Wend
Reverse_String = Replace(b, " ", "")

End Function

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