使用VBA对Excel中的多列进行sorting
我必须在Excel中对它们的值进行单独的列sorting。 我制定了以下程序:
With calcCalculations With .Sort .SortFields.Add Key:=Range("BR2:BR5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal .SortFields.Add Key:=Range("BV2:BV5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal .SortFields.Add Key:=Range("CA2:CA5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal .SortFields.Add Key:=Range("CD2:CD5000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal .SetRange Range("BR:CD") .Header = xlYes .MatchCase = True .Orientation = xlTopToBottom .SortMethod = xlPinYin End With End with
该过程不会出错,但它不会sorting我的数据。 我错过了什么吗?
正如user3514930所说:你在“ End With
之前”丢失了.Apply