我试图独立地在excel中对多个列进行排序。我有很多列,但保持行之间的顺序并不重要。任何简单的提示?
答案 0 :(得分:1)
这是一个宏。要编写宏,请确保进入开发功能区部分并将其添加到:
Sub SortIndividualJR()
Dim rngFirstRow As Range
Dim rng As Range
Dim ws As Worksheet
Application.ScreenUpdating = False
Set ws = ActiveSheet
Set rngFirstRow = ws.Range("A1:JR1")
For Each rng In rngFirstRow
With ws.Sort
.SortFields.Clear
.SortFields.Add Key:=rng, Order:=xlAscending
'assuming there are no blank cells..
.SetRange ws.Range(rng, rng.End(xlDown))
.Header = xlYes
.MatchCase = False
.Apply
End With
Next rng
Application.ScreenUpdating = True
End Sub
您可以更改范围以适合您拥有的列数。
答案 1 :(得分:0)
如果不需要是“代码”答案:
您是否尝试使用Home Ribbon>Sort&Filter>Custom Sort>Options
下的“排序列”功能,然后选择“从左到右排序”