Accending Order

Karan001

Board Regular
Joined
Jul 22, 2009
Messages
113
Hi Experts,
I have a column where there are so many value in rows.My requirement is to arrange all the row value in accending orders.

Available Value :

<TABLE style="WIDTH: 313pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=417><COLGROUP><COL style="WIDTH: 313pt; mso-width-source: userset; mso-width-alt: 15250" width=417><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 313pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20 width=417>8Weeks/1Week/4Weeks/1Year/2Years/26Weeks/12Weeks</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20>4Weeks/1Week/5Years/12Weeks/1.5 Year</TD></TR></TBODY></TABLE>

Requirement :-

<TABLE style="WIDTH: 339pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=452><COLGROUP><COL style="WIDTH: 339pt; mso-width-source: userset; mso-width-alt: 16530" width=452><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 339pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 height=20 width=452>1Week/4Weeks/8Weeks/12Weeks/26Weeks/1Year/2Years</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 339pt; HEIGHT: 15pt; BORDER-TOP: #ece9d8; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20 width=452>1Week/4Weeks/12Weeks/1.5 Year/5Years</TD></TR></TBODY></TABLE>


Regards,
Karan
 
Ok, solved already, but even so there's also this option:
Code:
Public Sub mySort()
    Dim wksTemp As Worksheet
    Dim rngCell1 As Range, rngCell2 As Range
    Dim varArray As Variant
    
    
    Set wksTemp = Sheets.Add
    
    For Each rngCell1 In Sheet1.Range("A1:A2") [B][COLOR="DarkGreen"]'change to reference the relevant range[/COLOR][/B]
        varArray = Split(rngCell1.Value, "/")
        varArray = Application.Transpose(varArray)
        With wksTemp
            .Cells.Clear
            With .Range("A1").Resize(UBound(varArray), 2)
                .Value = varArray
                For Each rngCell2 In .Offset(, 1).Resize(, 1)
                    With rngCell2
                        .Value = Replace$(.Value, "Week", "*7")
                        .Value = Replace$(.Value, "Year", "*365")
                        .Value = Replace$(.Value, "s", "")
                        .Value = Evaluate(.Value)
                    End With
                Next rngCell2
                .Sort Key1:=.Cells(1, 2), Order1:=xlAscending, Header:=xlNo
                varArray = .Resize(, 1).Value
                rngCell1.Value = Join$(Application.Transpose(varArray), "/")
            End With
        End With
    Next rngCell1
    
    Application.DisplayAlerts = False
        wksTemp.Delete
    Application.DisplayAlerts = True
End Sub
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top