Forum Discussion

Odintsov_Maksim's avatar
Odintsov_Maksim
Copper Contributor
May 23, 2020
Solved

Large amount of data sorting

Please, help.

Need to sort numeric data contained in large numbers (several thousand) strings.

The data in each string must be sorted separately.

How can this be done quickly.

16 Replies

  • wumolad's avatar
    wumolad
    Iron Contributor

    Hi Odintsov_Maksim 

     

    it might be difficult to visualize what you are trying to achieve without showing a sample data. Are you able to show a sample data after removing sensitive information?

     

    Cheers

      • Jos_Woolley's avatar
        Jos_Woolley
        Iron Contributor

        Odintsov_Maksim 

         

        Sub SortAllRows()
        
        Dim LRow    As Long
        Dim i       As Long
        Dim MyRow   As Range
        Dim MyKey   As Range
        
        With ThisWorkbook.Worksheets("Sheet1")
            LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
            For i = 1 To LRow
                Set MyRow = .Range("B1:I1").Offset(i - 1, 0)
                Set MyKey = Application.Index(MyRow, 1)
                MyRow.Sort Key1:=MyKey, Order1:=xlAscending, Orientation:=xlLeftToRight
            Next i
        End With
        
        End Sub

         

        Regards

Resources