PC Review


Reply
Thread Tools Rate Thread

Changing color of a shape

 
 
Mike
Guest
Posts: n/a
 
      7th Aug 2008
I have a rectangle in a spreadsheet, when I click on it I run a macro to do
some things and I want to change it's color. I have the following code but
it does not work:

With ActiveSheet.Shapes("Rectangle 9")
.Fill
.ForeColor
.RGB = RGB(0, 0, 0)
End With

What is wrong?


 
Reply With Quote
 
 
 
 
Susan
Guest
Posts: n/a
 
      7th Aug 2008
this is the code i got when i filled a rectangle pink:

ActiveSheet.Shapes("Rectangle 1").Select
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 45
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid


so it appears that yours should be:

With ActiveSheet.Shapes("Rectangle 9")
.Fill.ForeColor.RGB = RGB(0, 0, 0)
End With

hope that helps somewhat

susan


On Aug 7, 3:17*pm, Mike <M...@discussions.microsoft.com> wrote:
> I have a rectangle in a spreadsheet, when I click on it I run a macro to do
> some things and I want to change it's color. *I have the following codebut
> it does not work:
>
> * * With ActiveSheet.Shapes("Rectangle 9")
> * * * * .Fill
> * * * * .ForeColor
> * * * * .RGB = RGB(0, 0, 0)
> * * End With
>
> What is wrong?


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shape color macro Edwin Microsoft Excel Misc 0 5th Aug 2009 07:54 PM
Changing Shape Color and Weight At Same Time =?Utf-8?B?TWFyYyBGb3JnZXQ=?= Microsoft Word Document Management 1 7th Aug 2007 01:02 AM
shape color dubo Microsoft Excel Misc 0 14th Apr 2007 01:31 PM
Changing color of node in freeform shape =?Utf-8?B?anN0YW5zYnVyeQ==?= Microsoft Excel Programming 0 2nd Aug 2006 03:53 PM
VBA Help with changing shape color for selected shapes only Nimrod Microsoft Excel Programming 8 29th Apr 2005 01:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 PM.