ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing color of a shape (https://www.excelbanter.com/excel-programming/415347-changing-color-shape.html)

Mike

Changing color of a shape
 
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?



Susan

Changing color of a shape
 
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 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 code but
it does not work:

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

What is wrong?




All times are GMT +1. The time now is 12:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com