文件名称:AnHangPaiXu
介绍说明--下载内容均来自于网络,请自行研究使用
大家都知EXCEL只能按列排序,
此代码能让EXCEL实现按行排序的功能-Sub Macro1()
Dim i As Integer
For i = 2 To Sheet1.Range("a65535").End(xlUp).Row
Rows(i).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin, DataOption1:=xlSortNormal
Selection.Copy
Sheets("Sheet1").Select
Rows(i).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Cells(i, 1).Select
Next
End Sub
此代码能让EXCEL实现按行排序的功能-Sub Macro1()
Dim i As Integer
For i = 2 To Sheet1.Range("a65535").End(xlUp).Row
Rows(i).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin, DataOption1:=xlSortNormal
Selection.Copy
Sheets("Sheet1").Select
Rows(i).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Cells(i, 1).Select
Next
End Sub
(系统自动生成,下载前可以参看下载内容)
下载文件列表
AnHangPaiXu.xls