+ Reply to Thread
Results 1 to 3 of 3

Sort a string in VBA

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Sort a string in VBA

    Hi all,

    I have a string in VBA like the following:

    "A/12/3,C/4/18,D/14/2,B/23/1,A/13/4" and that goes on for a while
    Is there a way to sort the string so it would read:
    "A/12/3,A/13/4,B/23/1,C/4/18,D/14/2"

    The example is a very condensed version of reality, so I can't do it manually.
    Does anyone have any bright ideas or suggestions?

    Thanks,

    Jasper

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Sort a string in VBA

    There is a long loop called Bubble sort code which has been around for long time. You should be easily find it if you goggle it, or it might be on C Pearson's site

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Sort a string in VBA

    Hi Jasper, long time no speak, hope you're well

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] split and sort a string
    By se3unlock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-18-2015, 04:38 AM
  2. [SOLVED] String-like based Sort
    By AnushPatel in forum Excel General
    Replies: 6
    Last Post: 10-30-2014, 08:40 AM
  3. VBA sort string of numbers
    By dubbdan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-20-2013, 02:08 AM
  4. How to sort chains and add a string?
    By salaso69 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-26-2013, 01:33 AM
  5. Sort by part of a string
    By Motox in forum Excel General
    Replies: 3
    Last Post: 10-09-2012, 11:26 AM
  6. Sort by a portion of a String
    By Stupidav in forum Excel General
    Replies: 3
    Last Post: 10-07-2010, 04:50 PM
  7. building a sort string
    By Andrew Hicks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2007, 08:02 AM

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