frubeng
05-25-2010, 03:37 AM
I get the following error message and have now idea why or how to fix it :(
Run-time error '-2147417848 (80010108)':
Method 'ColorIndex' of object 'Font' failed
Any ideas?
MODULE1:
Sub color_cells(fire_rng As Range)
For Each C In fire_rng
If IsNumeric(C.Offset(0, -3).Value) Then
If C.Value < 0 Then
Range(C, C.Offset(0, -4)).Interior.ColorIndex = 9
Range(C, C.Offset(0, -5)).Font.ColorIndex = 2
C.Offset(0, -5) = "HI"
C.Offset(0, -5).Interior.ColorIndex = 3
Else
Range(C, C.Offset(0, -4)).Interior.ColorIndex = 1
Range(C, C.Offset(0, -4)).Font.ColorIndex = 2
If Not C.Offset(0, -5).Value = "HI" _
And Not C.Offset(0, -5).Value = "LO" Then
C.Offset(0, -5).Interior.ColorIndex = 1
C.Offset(0, -5).Font.ColorIndex = 2
End If
End If
Next C
End Sub
It highlights the line with Font.ColorIndex
Sub main()
Call color_cells(ActiveSheet.Range("f2:f60"))
Call color_cells(ActiveSheet.Range("l2:L60"))
Call color_cells(ActiveSheet.Range("r2:r60"))
End Sub
SHEET1:
Private Sub Worksheet_calculate()
Call main
End Sub
So main is being called all the time as values in sheet columns F, L and R are changing often.
If i click debug, then try to resume, it says: Out of Memory...
I just restarted and got the same error.
Run-time error '-2147417848 (80010108)':
Method 'ColorIndex' of object 'Font' failed
Any ideas?
MODULE1:
Sub color_cells(fire_rng As Range)
For Each C In fire_rng
If IsNumeric(C.Offset(0, -3).Value) Then
If C.Value < 0 Then
Range(C, C.Offset(0, -4)).Interior.ColorIndex = 9
Range(C, C.Offset(0, -5)).Font.ColorIndex = 2
C.Offset(0, -5) = "HI"
C.Offset(0, -5).Interior.ColorIndex = 3
Else
Range(C, C.Offset(0, -4)).Interior.ColorIndex = 1
Range(C, C.Offset(0, -4)).Font.ColorIndex = 2
If Not C.Offset(0, -5).Value = "HI" _
And Not C.Offset(0, -5).Value = "LO" Then
C.Offset(0, -5).Interior.ColorIndex = 1
C.Offset(0, -5).Font.ColorIndex = 2
End If
End If
Next C
End Sub
It highlights the line with Font.ColorIndex
Sub main()
Call color_cells(ActiveSheet.Range("f2:f60"))
Call color_cells(ActiveSheet.Range("l2:L60"))
Call color_cells(ActiveSheet.Range("r2:r60"))
End Sub
SHEET1:
Private Sub Worksheet_calculate()
Call main
End Sub
So main is being called all the time as values in sheet columns F, L and R are changing often.
If i click debug, then try to resume, it says: Out of Memory...
I just restarted and got the same error.