+ Reply to Thread
Results 1 to 8 of 8

reverse statement

Hybrid View

yjmmay34 reverse statement 07-20-2010, 04:54 AM
Andy Pope Re: reverse statement 07-20-2010, 05:00 AM
snb Re: reverse statement 07-20-2010, 05:14 AM
yjmmay34 Re: reverse statement 07-20-2010, 08:57 PM
Marcol Re: reverse statement 07-20-2010, 05:35 AM
ashish koul Re: reverse statement 07-20-2010, 07:37 AM
DonkeyOte Re: reverse statement 07-20-2010, 07:41 AM
romperstomper Re: reverse statement 07-20-2010, 07:40 AM
  1. #1
    Registered User
    Join Date
    04-12-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    96

    Unhappy reverse statement

    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.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: reverse statement

    Are all your values 2 characters long?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: reverse statement

    Function trever(c01)
       trever = StrReverse(c01)
    End Function
    In cell L1
    =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.

  4. #4
    Registered User
    Join Date
    04-12-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    96

    Re: reverse statement

    thank you snb. it can work now.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: reverse statement

    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)

  6. #6
    Registered User
    Join Date
    07-19-2010
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: reverse statement

    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

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: reverse statement

    ashish, given the existence of StrReverse Function (as illustrated by snb) there's no need to iterate the string.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: reverse statement

    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1