Im using the following code to assign numerical values to words in two columns, then multiplying the values together and painting a cell with a specific color assigned to the final number. The problem is it wont do this past row 19, any ideas as to why?
Suggestions for a better way to do this are VERY WELCOMED!
THANKS IN ADVANCE
Code
' Count till the last row
mLastRow = Sheet3.Cells(Rows.Count, "I").End(xlUp).Row
For m = mLastRow To 5 Step -1
' assign numerical values to the words in these columns
e = 22
r = 23
' Give Extent a value
If Cells(m, 9) = "Minor" Then
Cells(m, e) = 1
End If
If Cells(m, 9) = "Moderate" Then
Cells(m, e) = 5
End If
If Cells(m, 9) = "Serious" Then
Cells(m, e) = 8
End If
If Cells(m, 9) = "Critical" Then
Cells(m, e) = 10
End If
'Give Risk a value
If Cells(m, 10) = "Low" Then
Cells(m, r) = 1
End If
If Cells(m, 10) = "Medium" Then
Cells(m, r) = 5
End If
If Cells(m, 10) = "High" Then
Cells(m, r) = 10
End If
'Multiply values together
Cells(m, 24) = Cells(m, e) * Cells(m, r)
' Color cells according to value
If Cells(m, 24) >= 50 Then
Cells(m, 24).Interior.ColorIndex = 3
End If
If Cells(m, 24) >= 25 And Cells(m, 24) < 50 Then
Cells(m, 24).Interior.ColorIndex = 45
End If
If Cells(m, 24) >= 8 And Cells(m, 24) < 25 Then
Cells(m, 24).Interior.ColorIndex = 6
End If
If Cells(m, 24) >= 0 And Cells(m, 24) < 8 Then
Cells(m, 24).Interior.ColorIndex = 4
End If
Next m
Display More