Dim App As New MSExcel.Application
try
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\excel整理.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("sheet1") '指定工作
ws.rows("1:10").delete(MSExcel.XlDirection.xlUp)
Dim Rg As MSExcel.Range = Ws.UsedRange
For i As Integer = 1 To rg.Rows.Count
Dim str As String = ws.Cells(i,1).Value
If str = "computer" Then
ws.rows(i & ":" & (i+5)).delete(MSExcel.XlDirection.xlUp)
End If
Next
wb.Save
msgbox("成功")
catch ex As Exception
msgbox(ex.Message)
finally
app.quit
End try