I am encountering an error (Run-time error'1004': Unable to get the Interior property of the Range class) when a(4,1) = MinV.
Basically, the code runs fine when a(1,1) = MinV or a(2,1) = Min or a(3,1) = MinV. But the run time error occurs when the a(i,m) = MinV condition is true for i = 4

I have tried debugging but I couldn't figure out why the error occurs at i = 4.



Dim a, i As Long, FilePath As String, CellD As String, LC As Long, m As Long, LR As Long, MinV
    Dim myRange As Range
 
    LR = Worksheets("Data").Range("AF" & Rows.Count).End(xlUp).Row
 
    a = Worksheets("Data").Range("BB5:BB" & LR)
    m = 1
    Do
        MinV = Application.Min(a)
            
             For i = 1 To LR - 4
                    If LR <> 5 Then
                    If a(i, m) = MinV Then
                        With Worksheets("Data")
                            .Range(.Cells(i + 4, m + 41), .Cells(i + 4, m + 55)).Interior.ColorIndex = 35
                        End With
                    End If
                    End If
                Next
            
        Loop While Worksheets("Sheet2").Cells(i, m) = ""
End sub
Thanks for your help!