提问人:Sidvi 提问时间:11/6/2017 最后编辑:CommunitySidvi 更新时间:11/7/2017 访问量:49
else 语句上的下标超出范围错误
Subscript out of range error on an else statement
问:
当我尝试运行我的代码时,当它命中这段代码中的 else 语句时,我收到“下标超出范围”错误:
If Cells(i + 4 - n, 9).Value > 0 Then
Cells(i + 4 - n, 9).Interior.ColorIndex = RGB(93, 255, 132)
Else
Cells(i + 4 - n, 9).Interior.ColorIndex = RGB(255, 83, 83)
End If
谁能告诉我如何解决这个问题?
答:
0赞
Abhinav Rawat
11/6/2017
#1
尝试-
If Cells(i + 4 - n, 9).Value > 0 Then
Cells(i + 4 - n, 9).Interior.Color = RGB(93, 255, 132)
Else
Cells(i + 4 - n, 9).Interior.Color = RGB(255, 83, 83)
End If
评论
i
n
Interior.ColorIndex = RGB(93, 255, 132)