接下来没有 [英] Next without for
本文介绍了接下来没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在接收下一个错误:
Sub CTLines()
Dim iVal As Integer
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rng As Range
Set ws1 = Worksheets("INCIDENTS")
Set ws2 = Worksheets("INCDB")
iVal = Application.WorksheetFunction.CountIf(Range("AO5:AO999"), "Yes")
Dim i
For i = 1 To iVal
With Sheets("INCDB")
.Range("5:5").Insert Shift:=x1Down
Next i
End Sub
我尝试更改变量,缩进,很多东西,不成功。
I've tried changing the variable, the indent, many things and I've not been successful.
我想做的是计算在AO列中包含是
的行数在INCDB电子表格中添加多行。
All I want to do is to count how many rows contain Yes
in the AO column and add as many rows in the INCDB spreadsheet.
推荐答案
将代码更改为底部附近的
Change the code to this, near the bottom:
For i = 1 To iVal
With Sheets("INCDB")
.Range("5:5").Insert Shift:=x1Down
End With
Next i
VBA编译器不好在报告出错时,遇到有一行或多行缺少匹配终止行的代码。
The VBA compiler is not good at reporting what is wrong, when it encounters code that has one or more lines that are missing a matching termination line.
在您的情况下,您从未终止使用
语句。
In your case you never terminated the With
statement.
这篇关于接下来没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文