View Single Post
 
Old 01-16-2014, 09:09 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Windows XP Office 2007
Competent Performer
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Macro to reverse a test string

I wrote this little macro to reverse a text string. I have 2 questions:

  1. How can get the macro to leave the selection selected?
  2. Does anyone have any comments on the code? Is there a better way?

Code:
Sub MyRevText()
Dim oRange As Range
Dim sString As String

Set oRange = Selection.Range
sString = oRange.Text
sString = StrReverse(sString)
oRange.Text = sString

End Sub
Reply With Quote