Changing color of a shape

M

Mike

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?
 
S

Susan

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
 

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