简体   繁体   中英

Sort A-Z big file between targeted Words

I have a big text. There is an example I want to sort AZ only numbers in this example I don't want to each time select and sort each Category, maybe it possible do in one action?

apple
20
50
10
40
oranges
30
10
50
60
Bananas
10
5
80
10

As per my comment, your current data set-up is easily sorted through VBA. Couldn't help myself to throw together the following:


Sample data:

在此处输入图片说明


Sample code:

Sub Test()

Dim rng As Range, area As Range
Dim lr As Long

With Sheet1 'Change according to your sheets CodeName
    lr = .Cells(.Rows.Count, 1).End(xlUp).Row
    Set rng = .Range("A1:A" & lr).SpecialCells(xlCellTypeConstants, 1)
    For Each area In rng.Areas
        area.Sort area
    Next area
End With

End Sub

Result:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM