Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Changing Cell Color with macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris L - 25 Sep 2006 04:43 GMT
Hi,

Does anyone know how to change the cell color with macro in Excel 97.
The following code only works in Excel 2000

Sheet13.Cells(1,2).Interior.Color = RGB(126, 255, 126) 'Grey

In Excel 97, it gives the following error:
Unable to set the Color property of the Interior class

Regards,
Chris
MrScience - 25 Sep 2006 05:31 GMT
> Hi,
>
[quoted text clipped - 8 lines]
> Regards,
> Chris

I don't know if this will help, but I usually just use something like
this . . .
With Sheets("Sheet13")
Range("A2").Interior.Color = RGB(126,255,126)
End With
Bob Phillips - 25 Sep 2006 07:26 GMT
That code works perfectly well in Excel 97.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

> Hi,
>
[quoted text clipped - 8 lines]
> Regards,
> Chris
Dave Peterson - 25 Sep 2006 13:15 GMT
How do you execute this code?

Do you run it from a commandbutton placed on a worksheet (or another control
from the control toolbox toolbar)?

If yes, then maybe it's a bug in xl97 that was fixed in xl2k.

If you use a control that has a .takefocusonclick property, toggle that property
to false.

If you use a control that doesn't have that property, add this near the top of
your code:

activecell.activate

> Hi,
>
[quoted text clipped - 8 lines]
> Regards,
> Chris

Signature

Dave Peterson

Chris L - 26 Sep 2006 00:47 GMT
Hi,

The code was executed from a command control.
I've placed activecell.activate and now it works fine.
Thank you for your help.

Regards,
Chris

> How do you execute this code?
>
[quoted text clipped - 23 lines]
> > Regards,
> > Chris
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.