changing cell colors in excel 97

S

Steve

Why will the following code fail under Excel 97? The error
is a 1004 unable to set...

I have tried the code under office XP and it works but
only a small fraction of users have XP here..

The code is deployed in a module, and is called from a
button on the worksheet.

Sub alterSheet(Rng As Range, Default_Value As Variant)
Rng.Interior.ColorIndex = 19 'generates error xl 97
Rng.Font.ColorIndex = 5 'generates error xl 97
Rng.Value = Default_Value 'ok
End Sub

puzzled :-?

Steven
 
D

Dave Peterson

Are you using xl97 and running this from a commandbutton from the controls
toolbar placed on the worksheet?

If yes, try changing its .takefocusonclick property to false. (If it's a
control from that toolbar that doesn't have that property, try adding:

activecell.activate

to the top of your routing (a bug fixed in xl2k).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top