Can't change font property in Excel 2002

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

I have been using the following code in a procedure that puts a red "X" in a
cell when you click on it. It works fine in Excel 97 / 2000 but not in Excel
2002 (Runtime error 1004: Unable to set Color property of font class). In
fact it won't change any properties of the font class.
Has there been a change in the newer version? All these properties still
appear as available.

********************************************************************

Private Sub Worksheet_SelectionChange(ByVal Target As Range)


Target.Value = "X"
With Selection.Font
.ColorIndex = 3
.FontStyle = "regular"
End With
 
Your code runs fine for me under Excel 2002. Odd that you're getting an
error about the Color property when it's the ColorIndex property that your
changing. Does it help to change to:

With Target.Font
 
I didn't get any responses to the question below.
Can someone with excel 2002 try the code below and see if it works? If it
does I'll know it's something to do with my system and not Excel.
 
I think it's because the macros were written on Excel 2000. If I start
afresh in 2002 it works, but when I run my original 2000 workbook in 2002 it
crashed. Must be something lost in the conversion. I'll create a new
workbook in 2002 and copy and paste all the code across.
Thanks Gord for taking the time to try it.
 
Back
Top