EXCEL 编程 Object doesn't support this property or method 10
我在运行程序时出现Objectdoesn'tsupportthispropertyormethod点debug之后,这一行程序变黄:IfWorksheets("Repor...
我在运行程序时出现Object doesn't support this property or method
点debug之后,这一行程序变黄:If Worksheets("Report").Cell(i, 1) <> "Code" Or Worksheets("Report").Cell(i, 1) <> "Bundling completed" Then
我的代码如下
Sub aa()
Dim i As Integer
For i = 9201 To 1 Step -1
If Worksheets("Report").Cell(i, 1) <> "Code" Or Worksheets("Report").Cell(i, 1) <> "Bundling completed" Then
Range("a" & i).EntireRow.Delete
End If
Next
End Sub
目的就是删掉第一列不是Code和Bundling completed的其他所有行,请问代码的问题出在哪里?我刚刚开始学VB。请高手指教!谢谢! 展开
点debug之后,这一行程序变黄:If Worksheets("Report").Cell(i, 1) <> "Code" Or Worksheets("Report").Cell(i, 1) <> "Bundling completed" Then
我的代码如下
Sub aa()
Dim i As Integer
For i = 9201 To 1 Step -1
If Worksheets("Report").Cell(i, 1) <> "Code" Or Worksheets("Report").Cell(i, 1) <> "Bundling completed" Then
Range("a" & i).EntireRow.Delete
End If
Next
End Sub
目的就是删掉第一列不是Code和Bundling completed的其他所有行,请问代码的问题出在哪里?我刚刚开始学VB。请高手指教!谢谢! 展开
展开全部
因为Worksheets没有cell这个属性,所有就报错了,帮你修改如下,仅供参考:
Sub aa()
Dim i As Integer
Worksheets("Report").Activate
For i = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If Range("A" & i).Value <> "Code" And Range("A" & i).Value <> "Bundling completed" Then
Range("A" & i).EntireRow.Delete
End If
Next i
End Sub
Sub aa()
Dim i As Integer
Worksheets("Report").Activate
For i = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If Range("A" & i).Value <> "Code" And Range("A" & i).Value <> "Bundling completed" Then
Range("A" & i).EntireRow.Delete
End If
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询