VBA改写VB(对EXCEL排序)
发布网友
发布时间:2022-04-26 20:28
我来回答
共3个回答
热心网友
时间:2023-10-29 15:36
EXCELAPP.ActiveSheet.Range("A1:P99").Sort Key1:=Range("H1"), Order1:=1, Header:=0, OrderCustom:=1, MatchCase:=False, Orientation:=1, SortMethod:=1
当然,此语句之前你必须创建EXCELAPP对象:
Dim xlApp,EXCELAPP
Set xlApp = CreateObject("Excel.Application")
Set EXCELAPP = xlApp.Workbooks.Open("c:\1.xls")
热心网友
时间:2023-10-29 15:36
引用 microsoft excel 11
dim excelapp as new excel.applation
excelapp.visible=true
'这样可以打开一个excel程序
dim wb as workbook
set wb = excelapp.workbooks.open("c:\abc.xls")'或用add,打开文件
dim sht as worksheet
set sht = wb.worksheet(1)
'或
set sht = wb.activesheet
sht.Range("A1:P99").Sort Key1:=Range("H1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin
热心网友
时间:2023-10-29 15:36
Range("A1:p99").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("h1:h99"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("D5:D6")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
热心网友
时间:2023-10-29 15:36
EXCELAPP.ActiveSheet.Range("A1:P99").Sort Key1:=Range("H1"), Order1:=1, Header:=0, OrderCustom:=1, MatchCase:=False, Orientation:=1, SortMethod:=1
当然,此语句之前你必须创建EXCELAPP对象:
Dim xlApp,EXCELAPP
Set xlApp = CreateObject("Excel.Application")
Set EXCELAPP = xlApp.Workbooks.Open("c:\1.xls")
热心网友
时间:2023-10-29 15:36
引用 microsoft excel 11
dim excelapp as new excel.applation
excelapp.visible=true
'这样可以打开一个excel程序
dim wb as workbook
set wb = excelapp.workbooks.open("c:\abc.xls")'或用add,打开文件
dim sht as worksheet
set sht = wb.worksheet(1)
'或
set sht = wb.activesheet
sht.Range("A1:P99").Sort Key1:=Range("H1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin
热心网友
时间:2023-10-29 15:37
Range("A1:p99").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("h1:h99"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("D5:D6")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With