Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Reversing Cell Contents.
by Allen Wyatt
(last updated August 9, 2016)
Did you ever want to reverse the contents of what is contained in a cell? Using the Reverse macro, you can easily change "My text" to "txet yM." The macro is instructive in techniques to access and modify the contents of a cell.
Sub Reverse() If Not ActiveCell.HasFormula Then sRaw = ActiveCell.Text sNew = "" For J = 1 To Len(sRaw) sNew = Mid(sRaw, J, 1) + sNew Next J ActiveCell.Value = sNew End If End Sub
This macro only affects a single selected cell, and it will not make any changes to a cell that contains a formula.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3451) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Reversing Cell Contents.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Excel allows you to easily paste graphics into a worksheet. Once added, you may want to quickly process the graphics by ...Discover More
If you have a macro that selects different columns in a worksheet while processing information, you may get some ...Discover More
As your macro is processing information, there will doubtless be times that it will need to compare information in ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.