怎么用VB删除EXCEL里对应内容的行
2个回答
展开全部
已经先打开的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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询