There is no reason to loop on the number of columns. Based on your posted code you are only modifying the Cell in column 1.
Your Do Loop will never end because the current column is always 1. Why are you even using a Do Loop?
Another possible error that I can see is that if the grid cell is an empty string then the line NumAbs = CInt(Absences)
will fail with a type mismatch error.
Sorry, I did not have time to test this code but it should work.VB Code:
With fgMonthA3rd .Redraw = False .Col = 1 For i = 1 To .Rows - 1 Absences = .TextMatrix(i,1) NumAbs = CInt("0" & Absences) 'Or even NumAbs = CInt("0" & .TextMatrix(i,1)) and remove the Absences = .TextMatrix(i,1) statement If NumAbs >= 2 Then .Row = i .CellBackColor = vbRed End If Next .Redraw = True End With




Reply With Quote