VBScript 代码:对表格区域进行升序排序
Sub SortTableArea() Dim lngRow As Long, lngCol As Long, lngRowCount As Long, lngColCount As Long Dim oRg As Range
On Error Resume Next
Set oRg = Selection
On Error GoTo 0
If oRg Is Nothing Then Exit Sub
lngRow = oRg.Row
lngCol = oRg.Column
lngRowCount = oRg.Rows.Count
lngColCount = oRg.Columns.Count
Range(Cells(lngRow + 1, lngCol), Cells(lngRow + lngRowCount - 1, lngCol + lngColCount - 1)).Sort Key1:=Cells(lngRow, lngCol), Order1:=xlAscending, Header:=xlYes
End Sub
原文地址: https://www.cveoy.top/t/topic/lfY0 著作权归作者所有。请勿转载和采集!