vb编程计算中 if 语句块的语法问题 运行时提示“endif缺少if语句块”For j = 5 To aIf Cells(j,8) >= 0 ThenCells(j,9) = Cells(j,8)ElseFor m = -1 To -jIf Cells(j + m,8) > 0 Thenb = Cells(j + m,8)End IfExit ForFor n = 1 To a - jIf Ce
来源:学生作业帮助网 编辑:六六作业网 时间:2025/02/04 04:43:39
vb编程计算中 if 语句块的语法问题 运行时提示“endif缺少if语句块”For j = 5 To aIf Cells(j,8) >= 0 ThenCells(j,9) = Cells(j,8)ElseFor m = -1 To -jIf Cells(j + m,8) > 0 Thenb = Cells(j + m,8)End IfExit ForFor n = 1 To a - jIf Ce
vb编程计算中 if 语句块的语法问题 运行时提示“endif缺少if语句块”
For j = 5 To a
If Cells(j,8) >= 0 Then
Cells(j,9) = Cells(j,8)
Else
For m = -1 To -j
If Cells(j + m,8) > 0 Then
b = Cells(j + m,8)
End If
Exit For
For n = 1 To a - j
If Cells(j + n,8) > 0 Then
c = Cells(j + n,8)
End If
Exit For
Cells(j,9) = (b + c) / 2
End If
Next j
vb编程计算中 if 语句块的语法问题 运行时提示“endif缺少if语句块”For j = 5 To aIf Cells(j,8) >= 0 ThenCells(j,9) = Cells(j,8)ElseFor m = -1 To -jIf Cells(j + m,8) > 0 Thenb = Cells(j + m,8)End IfExit ForFor n = 1 To a - jIf Ce
请给你的代码加上注释,保持好正确的缩进,以及:给你的for加上next 想要完美可以在next后面加上是结束 哪一个for.另外,exit for是退出循环的命令,不是确定for循环边界的命令.所以,你的错误在for没有足够的next