請參考如下程式碼: Range("A1:A10").Select "選中需要排序的資料區域 "按A列升序排,有標題行 Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _ :=xlPinYin, DataOption1:=xlSortTextAsNumbers "按A列降序排,無標題行 Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _ :=xlPinYin, DataOption1:=xlSortNormal在宏編輯器中,點中程式碼中的 Selection.Sort 再按 F1,即可看到Excel VBA關於排序的完整詳細的幫助說明與舉例.GoodLuck!
請參考如下程式碼: Range("A1:A10").Select "選中需要排序的資料區域 "按A列升序排,有標題行 Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _ :=xlPinYin, DataOption1:=xlSortTextAsNumbers "按A列降序排,無標題行 Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _ :=xlPinYin, DataOption1:=xlSortNormal在宏編輯器中,點中程式碼中的 Selection.Sort 再按 F1,即可看到Excel VBA關於排序的完整詳細的幫助說明與舉例.GoodLuck!