如何将如下语句转为VB呢?
Selection.Sort Key1:=Range("B1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin
Selection.Sort Key1:=Range("B1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin
Private Const xlGuess As Long = 0
Private Const xlTopToBottom As Long = 1
Private Const xlPinYin As Long = 1Sub sortData()
Dim xls As Object
Set xls = CreateObject("excel.application")
xls.Visible = True
xls.Workbooks.Open "c:\test.xls"
With xls.ActiveWorkbook.Sheets("Sheet1")
.Range(Cells(1, 1), Cells(50, 50)).sort Key1:=.Range("B1"), _
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, SortMethod:=xlPinYin
End With
Set xls = Nothing
End Sub
----------
假设Select的是Cells(1,1)到Cells(50,50)
还有,我是在新建的excel时,使用这些语句的
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin