PDA

Click to See Complete Forum and Search --> : Text Direction from right to left in Excel


odehjas
Nov 14th, 2005, 02:58 AM
Hello,

How to set the text direction from right to left in Excel using the VBA. Thanks.

Regards
Odeh

malik641
Nov 14th, 2005, 08:58 AM
Thanks to John Walkenbach's book: Microsoft Excel 2000 Formulas :thumb:
Function REVERSETEXT(text) As String
'Returns its argument, reversed
Dim TextLen As Integer
Dim i As Integer
TextLen = Len(text)
For i = TextLen To 1 Step -1
REVERSETEXT = REVERSETEXT & Mid(text, i, 1)
Next i
End Function
Use this in a cell as:

=REVERSETEXT(A1)

Where A1 would have your text.
HTH

odehjas
Nov 14th, 2005, 10:11 AM
Many Thanks