ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   autoshapes - identification and property change (https://www.excelbanter.com/excel-programming/426910-autoshapes-identification-property-change.html)

Marcin Peciak

autoshapes - identification and property change
 
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


OssieMac

autoshapes - identification and property change
 
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


--
Regards,

OssieMac


"Marcin Peciak" wrote:

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



All times are GMT +1. The time now is 07:26 PM.

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