A function to reverse a string

Very simple, uses the VBA function StrReverse to reverse the input string.

‘A function to reverse a string provided as input
‘For example, the string “abcd” will become “dcba”
‘Uses the VBA function StrReverse
Public Function ReverseString(sInputString As String) As String
On Error GoTo ReverseString_Error
    
ReverseString = StrReverse(sInputString)
    Exit Function

ReverseString_Error:
    ReverseString = “#ERROR#”
End Function

About the Author

A co-author of Data Science for Fundraising, an award winning keynote speaker, Ashutosh R. Nandeshwar is one of the few analytics professionals in the higher education industry who has developed analytical solutions for all stages of the student life cycle (from recruitment to giving). He enjoys speaking about the power of data, as well as ranting about data professionals who chase after “interesting” things. He earned his PhD/MS from West Virginia University and his BEng from Nagpur University, all in industrial engineering. Currently, he is leading the data science, reporting, and prospect development efforts at the University of Southern California.

  • nkarthick says:

    Hi
    Simple and superb code
    Please do visit my VBA blog
    http://chennaivba.blogspot.com
    and give me your thought.
    Thanks

  • >