我是新来编写代码在Excel VBA中,我收到编译错误下一个没有对.....然而,我有一个和下一个,你能告诉我我是什么做错了,请参阅下面的代码,谢谢!编译错误,下一步没有为
Dim i As Integer
For i = 19 To 49
If Cells(3, i) > 499999 Then
Cells(4, 3) = 499999
ElseIf Cells(3, i) < 499999 Then
Cells(4, 3) = Cells(3, i)
End If
If Cells(4, 3) < 499999 Then
Cells(4, 5) = 0
If Cells(3, i) > 999999 Then
Cells(4, 4) = 500000
ElseIf Cells(3, i) < 999999 Then
Cells(4, 4) = Cells(3, i) - 499999
End If
If Cells(4, 4) = 0 Then
Cells(4, 5) = 0
ElseIf Cells(3, i) > 1999999 Then
Cells(4, 5) = 1000000
ElseIf Cells(3, i) < 1999999 Then
Cells(4, 5) = Cells(3, i) - 999999
End If
If Cells(4, 5) = 0 Then
Cells(4, 6) = 0
ElseIf Cells(3, i) > 4999999 Then
Cells(4, 6) = 3000000
ElseIf Cells(3, i) < 4999999 Then
Cells(4, 6) = Cells(3, i) - 1999999
End If
If Cells(4, 6) = 3000000 Then
Cells(4, 7) = Cells(3, i) - 4999999
ElseIf Cells(4, 6) < 3000000 Then
Cells(4, 7) = 0
End If
Range(7, i).Value = (Cells(5, 3) + Cells(5, 4) + Cells(5, 5) + Cells(5, 6) + Cells(5, 7))/Cells(3, i)
Next i
End Sub
错字:'如果细胞(3,I)> 999999 Then'应该是'elseif的细胞(3,I)> 999999然后' –
提示:下一次,注释掉所有的if语句,然后取消注释一次,如果一次发现,直到找到错误。 – Jules