已经先打开的excel文档,每删3行保留1行
Private Sub Command1_Click()
Dim i, j As Integer
Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlBook = xlApp.Workbooks.Open("d:\book1.xls")
Set xlSheet = xlBook.Worksheets(1)
xlApp.Visible = True
For i = 1 To 100
For j = 1 To 3
xlSheet.Rows(i).Delete ' Shift:=xlUp
Next
Next
end
采用vba语言,或用vb调用Excel程序!