Results 1 to 5 of 5

How do I move characters within a string? Or how do I recognize them?

Threaded View

111StepsAhead How do I move characters... 12-02-2011, 12:04 PM
arthurbr Re: How do I move characters... 12-02-2011, 12:09 PM
Domski Re: How do I move characters... 12-02-2011, 12:17 PM
111StepsAhead Re: How do I move characters... 12-02-2011, 12:36 PM
StephenR Re: How do I move characters... 12-02-2011, 01:30 PM
  1. #1
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    How do I move characters within a string? Or how do I recognize them?

    If I have a cell with a string, like 123AB, is there a way I can use a macro to move the letters to the front of the string?

    Option Explicit
    
    Sub moveData()
        Dim LastRow As Long
        Dim x As Integer
    
        Worksheets("Main").Activate
        LastRow = Range("C65536").End(xlUp).row
    
        For x = 1 To LastRow
            If Range("C" & x).Value <> "" Then
                'Call a function that moves any characters to the front.
            End If
        Next x
    End Sub
    
    Sub moveCharacters(theTarget As String)
        'move the characters.
    End Sub
    So does anyone know how to do this? The format is generally the same but could slightly vary.

    123AB
    123A
    12AB
    1AB
    etc.

    But the end result does the same thing to each value.

    AB123
    A123
    AB12
    AB1
    etc.

    I appreciate your guys help.
    Last edited by 111StepsAhead; 12-02-2011 at 12:35 PM.

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