autoshapes - identification and property change

  • Thread starter Thread starter Marcin Peciak
  • Start date Start date
M

Marcin Peciak

Hi All,

I have theree rectangles in a spreadsheet, each calls a cell in order to
display a value (i.e =A1).
I tried to change object colors, size based on the values displayed - for
example - to scale size of the object.

How to do this? I used macro recorder, but I cant get into object
properties - as the editor, didnt show the drawing objects in the code?

Many thanks,
Marcin
 
Hi Marcin,

The following should help. Note the comments and also that some of the lines
of code are commented out and are there to show alternatives and additional
code that might be helpful in the example.


With ActiveSheet.Shapes("Rectangle 1")
.Width = 50
.Height = 20

'Use following if width and height in cell values
'.Width = ActiveSheet.Range("A1")
'.Height = ActiveSheet.Range("A2")

'Lookup RGB function for more colors
.Fill.ForeColor.RGB = RGB(255, 255, 0) 'Yellow
'.Fill.ForeColor.RGB = RGB(0, 0, 255) 'Blue

'Alternative color code.
'Test SchemeColors for required color.
'.Fill.ForeColor.SchemeColor = 1 'White
'.Fill.ForeColor.SchemeColor = 0 'Black

'Scales the shape (Numbers less than 1 reduce; greater than 1 enlarge)
'.ScaleWidth 0.73, msoFalse, msoScaleFromTopLeft
'.ScaleHeight 0.57, msoFalse, msoScaleFromTopLeft

End With
 
Back
Top