View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default VBA Help with changing shape color for selected shapes only

try
with selection
..ShapeRange.Fill.ForeColor.SchemeColor = 10

end with

--
Don Guillett
SalesAid Software

"Nimrod" wrote in message
...
I'm in need of help. I have an Excel sheet that has some rectangle

shapes.
I want to add some command buttons to change the color of these

rectangles,
but I only want those shapes I select to be changed.

Here is a "Reset" command button code I use to turn all my shapes Red:

Private Sub CommandButton1_Click()
ActiveSheet.Shapes.SelectAll
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Range("A1").Select
End Sub

Now I know how to change a single shape that I specify:

ActiveSheet.Shapes("Rectangle 1").Select

But how do I change only the ones I currently have selected? And is there

a
better way to unselect (deselect) rather than using Range("A1").Select?

Thanks in advance,

Scott