Tuesday, February 08, 2011

Invert text in a cell


If cell A1 contains:
microsoft excel

The formula/function in cell B1:

lecxe tfosorcim


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Adding the Macro
1. Copy the below macro, by highlighting the macro code and pressing the keys CTRL+C
2. Open your workbook
3. Press the keys ALT+F11 to open the Visual Basic Editor
4. Press the keys ALT+I to activate the Insert menu
5. Press M to insert a Standard Module
6. Paste the code by pressing the keys CTRL+V
7. Press the keys ALT+Q to exit the Editor, and return to Excel.


Option Explicit
Function ReverseCell(Rcell As Range, Optional IsText As Boolean)
'Enter the function like this for text:
'Or either of the ways below for numeric data
Dim i As Integer
Dim StrNewNum As String
Dim strOld As String
strOld = Trim(Rcell)
For i = 1 To Len(strOld)
  StrNewNum = Mid(strOld, i, 1) & StrNewNum
Next i
If IsText = False Then
  ReverseCell = CLng(StrNewNum)
  ReverseCell = StrNewNum
End If
End Function



Came from : http://excel.bigresource.com/Track/excel-cBcjrDfS/ thanks !

Post a Comment

Blog Archive