I had thousand of data which need to Sort left to right rows in numerical order but except s/n
here is the sample data base. (but the row contain data can be as many as this)
is there any fast way to do it?? mil thanks.
[TABLE="width: 500"]
<tbody>[TR]
[TD]s/n[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1111[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1112[/TD]
[TD][/TD]
[TD]23[/TD]
[TD][/TD]
[TD]434[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1113[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1114[/TD]
[TD]34[/TD]
[TD][/TD]
[TD]555[/TD]
[TD]555[/TD]
[TD]545[/TD]
[/TR]
[TR]
[TD]1115[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1116[/TD]
[TD]642[/TD]
[TD]3[/TD]
[TD]9[/TD]
[TD][/TD]
[TD]111[/TD]
[/TR]
</tbody>[/TABLE]
I got this code from https://www.mrexcel.com/forum/excel-questions/693675-rearrange-columns-w-visual-basic-applications-using-row-sort-order.html , it look well but how to excluded the first col?
here is the sample data base. (but the row contain data can be as many as this)
is there any fast way to do it?? mil thanks.
[TABLE="width: 500"]
<tbody>[TR]
[TD]s/n[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1111[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1112[/TD]
[TD][/TD]
[TD]23[/TD]
[TD][/TD]
[TD]434[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1113[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1114[/TD]
[TD]34[/TD]
[TD][/TD]
[TD]555[/TD]
[TD]555[/TD]
[TD]545[/TD]
[/TR]
[TR]
[TD]1115[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1116[/TD]
[TD]642[/TD]
[TD]3[/TD]
[TD]9[/TD]
[TD][/TD]
[TD]111[/TD]
[/TR]
</tbody>[/TABLE]
I got this code from https://www.mrexcel.com/forum/excel-questions/693675-rearrange-columns-w-visual-basic-applications-using-row-sort-order.html , it look well but how to excluded the first col?
Code:
Sub SortLtoR()
Dim ws As Worksheet
Dim rng As Range
Set ws = ActiveSheet
Set rng = ws.UsedRange
With ws.Sort
With .SortFields
.Clear
.Add rng.Rows(1)
End With
.SetRange rng
.Header = xlYes
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
End Sub[COLOR=#3E3E3E]
[/COLOR]
Last edited: