Hi, all. I want to reverse the value in cell K1 "Q1" to "1Q" . how should i write a code to make it work? pls help. thank you!
Hi, all. I want to reverse the value in cell K1 "Q1" to "1Q" . how should i write a code to make it work? pls help. thank you!
Last edited by yjmmay34; 07-20-2010 at 08:57 PM.
Are all your values 2 characters long?
In cell L1![]()
Function trever(c01) trever = StrReverse(c01) End Function
=trever(K1)
or
![]()
sub trever() for each cl in selection cl.value=strReverse(cl.value) next End Sub
Last edited by snb; 07-20-2010 at 06:02 AM.
thank you snb. it can work now.
Or maybe?
If you just want to move a single code letter to the begining of the string and retain the number as is.
![]()
=RIGHT(A1,LEN(A1)-1)&LEFT(A1)
![]()
Function revrese(x) Dim c As String c = "" For i = 1 To Len(x) c = Mid(x, i, 1) & c Next i revrese = c End Function
ashish, given the existence of StrReverse Function (as illustrated by snb) there's no need to iterate the string.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Ashish,
Unless you like SPAM, I strongly recommend you remove your email address from your signature!
Everyone who confuses correlation and causation ends up dead.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks