A VBA Excel Loop Question??
I need to loop though a range of cells but I need to skip those cells that have an AVERAGE formula in them...
This is what I currently have:
VB Code:
Sheet1.Range("j6").Select
Do Until ActiveCell.Value = "N/A"
Select Case ActiveCell.Value
Case Is >= 70
ActiveCell.Font.ColorIndex = 1
ActiveCell.Interior.ColorIndex = 6
Case 62.4 To 69.4
ActiveCell.Font.ColorIndex = 1
ActiveCell.Interior.ColorIndex = 44
Case 54.4 To 62.4
ActiveCell.Font.ColorIndex = 1
ActiveCell.Interior.ColorIndex = 45
Case 45.4 To 54.4
ActiveCell.Font.ColorIndex = 1
ActiveCell.Interior.ColorIndex = 46
Case 37.4 To 45.4
ActiveCell.Font.ColorIndex = 1
ActiveCell.Interior.ColorIndex = 3
Case Is = ""
ActiveCell.Font.ColorIndex = 1
ActiveCell.Interior.ColorIndex = 2
Case Is <= 37
ActiveCell.Font.ColorIndex = 2
ActiveCell.Interior.ColorIndex = 1
End Select
ActiveCell.Offset(1, 0).Select
Loop
Sheet1.Range("e4").Select
This will work fine in color codeing the cells that fall in a range, but in the range that I am looping through there are rows that are designated for averaging specific cells...For example - Cells A1:A3 are averaged at A4...then A6:A9 are averaged at A10.
The problem happens when there is no data in some of these cells that cause the AVERAGE to show -#DIV/0! this causes a Type Mismatch Error.
Can someone please assist me with figuring this out?
Thank you.