用VB删除EXCEL中不符合条件的整行数据代码 5
代码如下,但是删除整行(xlsWorkboo.Rows("i:").DeleteShift:=xlUp)这里出错,求解。DimxlAppAsExcel.Applicati...
代码如下,但是删除整行(xlsWorkboo.Rows("i:").Delete Shift:=xlUp)这里出错,求解。
Dim xlApp As Excel.ApplicationDim xlBook As Excel.WorkbookDim xlSheet As Excel.Worksheet
Private Sub Command1_Click()Dim a(4, 2600) As LongDim i, j, k As LongSet xlsApp = CreateObject("Excel.Application")Set xlsWorkbook = xlsApp.Workbooks.Open("D:\my.xls") j = 1For i = 2 To 2599 k = i + 1 If a(3, i) <= 9.9 And j > 3 Then xlsWorkboo.Rows("i:").Delete Shift:=xlUp '删除不符合条件的整行,下行上移 j = j + 1 If a(4, i) <> a(4, k) Then j = 0Next
i End Sub 展开
Dim xlApp As Excel.ApplicationDim xlBook As Excel.WorkbookDim xlSheet As Excel.Worksheet
Private Sub Command1_Click()Dim a(4, 2600) As LongDim i, j, k As LongSet xlsApp = CreateObject("Excel.Application")Set xlsWorkbook = xlsApp.Workbooks.Open("D:\my.xls") j = 1For i = 2 To 2599 k = i + 1 If a(3, i) <= 9.9 And j > 3 Then xlsWorkboo.Rows("i:").Delete Shift:=xlUp '删除不符合条件的整行,下行上移 j = j + 1 If a(4, i) <> a(4, k) Then j = 0Next
i End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询