|
VBA菜鸟
最近在写一个VBA,运行下面的程序,结果直接弹出对话框 "编译错误 NEXT 没有 for"
求教大神,这是因为什么原因(弹出那段话时,最下面的那个NEXT被标蓝)
Sub 检查基础信息()
Dim i As Integer, arr(0), brr(0), crr(0), xrow As Integer, j As Integer
For i = 2 To Range("a1").End(xlDown).Row - 1
arr(0) = Range("b" & i) '装入借据号
brr(0) = Range("g" & i) '装入计息余额
crr(0) = Range("d" & i) '装入贷款时间
With ActiveWorkbook.Worksheets(1) '向工作薄里的第1张表里添加记录
xrow = .Range("A1").CurrentRegion.Rows.Count + 2 '取得表格中第一条空行号
.Cells(xrow, 10).Resize(1, 1) = arr(0) '将数组写入单元格区域
.Cells(xrow, 14).Resize(1, 1) = brr(0)
.Cells(xrow, 11).Resize(1, 1) = crr(0)
Worksheets(1).Activate
For j = 2 To Range("a1").End(xlDown).Row
If Cells(j, 10) = Cells(xrow, 10) And Cells(j, 14) = Cells(xrow, 14) And Cells(j, 11) = Cells(xrow, 11) Then
MsgBox "基础信息正确!"
Else
MsgBox "不正确!"
End If
Next
With ActiveWorkbook.Worksheets(2)
Next
End Sub
|
|