Hello. Look for an icon that enables me to sort file links on column B From the smallest to the largest, if you notice the second row with the number 10, it is supposed to be 2 and so on to the end of the column in order
Thank you for the reply.I replaced you manually and copied it into another sheet and recorded a macro for clarification.I lack to return it to sheet 1 starting from cell B12Yep, that is because you have text entries and are therefore sorting alphabetically, not numerically.
So everything that starts out with:
5may\11-data\1
will come before any entries that starts:
5may\11-data\2
The best way to get it to sort the way you want is to change the format so that all those numbers have the same number of digits (i.e. 2),
so your single digit entries should be changed like this:
5may\11-data\01
5may\11-data\02
Then it is very easy to sort exactly the way you want.
Sheet1.Activate
Range("B12").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("sumrec").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="\", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), _
TrailingMinusNumbers:=True
ActiveWindow.SmallScroll Down:=-33
Columns("A:D").Select
ActiveWorkbook.Worksheets("sumrec").Sort.SortFields.clear
ActiveWorkbook.Worksheets("sumrec").Sort.SortFields.Add2 Key:=Range("B1:B1000" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("sumrec").Sort.SortFields.Add2 Key:=Range("C1:C1000" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("sumrec").Sort
.SetRange Range("A1:D1000")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
I am not really sure what you are showing/asking me here.Thank you for the reply.I replaced you manually and copied it into another sheet and recorded a macro for clarification.I lack to return it to sheet 1 starting from cell B12
View attachment 93210
VBA Code:Sheet1.Activate Range("B12").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Sheets("sumrec").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("B1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _ Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _ :="\", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), _ TrailingMinusNumbers:=True ActiveWindow.SmallScroll Down:=-33 Columns("A:D").Select ActiveWorkbook.Worksheets("sumrec").Sort.SortFields.clear ActiveWorkbook.Worksheets("sumrec").Sort.SortFields.Add2 Key:=Range("B1:B1000" _ ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal ActiveWorkbook.Worksheets("sumrec").Sort.SortFields.Add2 Key:=Range("C1:C1000" _ ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("sumrec").Sort .SetRange Range("A1:D1000") .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With
1
2
3
4
5
6
7
8
9
10
11
...
01
02
03
04
05
06
07
08
09
10
11
...
Thank you again. I'll really try that.I am not really sure what you are showing/asking me here.
What I am suggesting is changing the naming convention of your folders from:
toRich (BB code):1 2 3 4 5 6 7 8 9 10 11 ...
Rich (BB code):01 02 03 04 05 06 07 08 09 10 11 ...
Then sorting will work the way you want naturally.