ColorIndex Sub-Routine not working as expected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using XL 2003 & 97


The following routine is not functioning as expected.

I expect that if the font color and the interior color are the same

i.e. both white or the value of 2, that the interior color of the respective
cell
would be changed to Gray.

When I recorded a macro for both variables, they were both valued as "2"

Therefore, if 2=2 then the fill color s/b Gray? No?

************************
Sub ColorCellGray()

If Selection.Font.ColorIndex = Selection.Interior.ColorIndex Then
With Selection.Interior
.ColorIndex = 38 ' Gray
End With
End If

End Sub
***********************


TIA Dennis
 
Back
Top