+ Reply to Thread
Results 1 to 7 of 7

Sorting numbers

Hybrid View

  1. #1
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Sorting numbers

    Is this is what you are after?

    Public Function ArraySort(ByVal vValue As Variant) As String
    
    Dim strv As String, strtemp As String, strFinal As String
    Dim i As Integer, x As Integer, y As Integer
    Dim strArray As Variant
    
    strv = vValue
    
    For i = 1 To Len(strv)
        strtemp = strtemp & "," & Mid(strv, i, 1)
    Next i
    
    strtemp = Right(strtemp, Len(strtemp) - 1)
    strArray = Split(strtemp, ",")
    
    For x = LBound(strArray) To (UBound(strArray) - 1)
        For y = (x + 1) To UBound(strArray)
            If strArray(x) > strArray(y) Then
                strtemp = strArray(x)
                strArray(x) = strArray(y)
                strArray(y) = strtemp
                strtemp = ""
            End If
        Next y
    Next x
    
    For i = LBound(strArray) To UBound(strArray)
        strFinal = strFinal & strArray(i)
    Next i
    
    ArraySort = strFinal
    
    End Function
    Attached Files Attached Files

+ 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. Help sorting numbers
    By digger12 in forum Excel General
    Replies: 1
    Last Post: 08-03-2011, 06:54 AM
  2. [SOLVED] Sorting - cells containing numbers, numbers and letters
    By Gunny in forum Excel General
    Replies: 5
    Last Post: 07-15-2006, 08:30 PM
  3. [SOLVED] Sorting numbers with differing numbers of digits
    By Trudy in forum Excel General
    Replies: 5
    Last Post: 03-04-2006, 08:35 AM
  4. Sorting texts and numbers as if it was all numbers
    By Werner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-07-2005, 04:05 PM
  5. sorting the row by numbers
    By Jen in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-12-2005, 03:06 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