IF语句错误9(下标超出范围)

时间:2019-11-29 01:28:13

标签: excel vba runtime-error

在下面的代码中,我得到了运行时错误9:下标行上的下标超出范围问题,并且我无法确定问题。有任何想法吗?任何帮助将不胜感激。

Dim wb As Workbook
Dim wsOPS As Worksheet
Set wb = ActiveWorkbook
Dim LastRow As Long
Dim i As Integer
Dim DeletedTL() As Integer
Dim ArraySize As Integer
Set wsOPS = wb.Worksheets.Add(Type:=xlWorksheet)

With wsOPS
    .Name = "OPS"
End With

LastRow = Sheets("OPS").UsedRange.Rows.Count
ArraySize = 0
For i = 1 To LastRow
    If wsOPS.Range("A" & i).FormatConditions(1).Interior.Color = 0 Then '******Error here******
        ArraySize = ArraySize + 1
        DeletedTL = wsOPS.Range("C" & i)
    End If
Next i

0 个答案:

没有答案