Excel

Function To Reverse a String In a Cell

Ease of Use

Easy

Version tested with

2002 

Submitted by:

Jacob Hilderbrand

Description:

This function will reverse the supplied text. 

Discussion:

VBA has a built in function to reverse a string, but this cannot be done from a cell by default. This function will allow you to easily reverse any string. 

Code:

instructions for use

			

Option Explicit Public Function ReverseString(Text As String) ReverseString = StrReverse(Text) End Function

How to use:

  1. Open Excel.
  2. Alt + F11 to open the VBE.
  3. Insert | Module.
  4. Paste the code there.
  5. Close the VBE (Alt + Q or press the X in the top-right corner).
 

Test the code:

  1. In a cell type = reversestring(D1) where D1 can be a cell address, or the value/text you want to reverse.
 

Sample File:

No Attachment 

Approved by mdmackillop


This entry has been viewed 163 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2014 VBA Express