Excel VBA shape arrat

mbri0029

New Member
Joined
Jul 26, 2019
Messages
1
hi guys,

i need to be able to create an array of circles. for example, if cell A1 has the value 5 in it, and cell A2 has the value 600, then i need to be able to fit 5 circles in the width of 600... I hope i explained myself properly.

Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try this:-
NB:- You can get the basics for this , from the Macro recorder
Code:
[COLOR="Navy"]Sub[/COLOR] MG26Jul27
[COLOR="Navy"]Dim[/COLOR] Shp [COLOR="Navy"]As[/COLOR] Shape, Shp1 [COLOR="Navy"]As[/COLOR] Shape, Dm [COLOR="Navy"]As[/COLOR] Double, Shp2 [COLOR="Navy"]As[/COLOR] Shape, Shp3 [COLOR="Navy"]As[/COLOR] Shape, Shp4 [COLOR="Navy"]As[/COLOR] Shape, Shp5 [COLOR="Navy"]As[/COLOR] Shape
Dm = [a2] / [a1]
[COLOR="Navy"]Set[/COLOR] Shp = ActiveSheet.Shapes.AddShape(msoShapeOval, 20, 20, [a2], [a2])
[COLOR="Navy"]Set[/COLOR] Shp1 = ActiveSheet.Shapes.AddShape(msoShapeOval, 20, 20 + [a2] / 2 - Dm / 2, Dm, Dm)
Shp1.Fill.ForeColor.SchemeColor = 2
[COLOR="Navy"]Set[/COLOR] Shp2 = ActiveSheet.Shapes.AddShape(msoShapeOval, 20 + Dm, 20 + [a2] / 2 - Dm / 2, Dm, Dm)
Shp2.Fill.ForeColor.SchemeColor = 3
[COLOR="Navy"]Set[/COLOR] Shp3 = ActiveSheet.Shapes.AddShape(msoShapeOval, 20 + Dm * 2, 20 + [a2] / 2 - Dm / 2, Dm, Dm)
Shp3.Fill.ForeColor.SchemeColor = 4
[COLOR="Navy"]Set[/COLOR] Shp4 = ActiveSheet.Shapes.AddShape(msoShapeOval, 20 + Dm * 3, 20 + [a2] / 2 - Dm / 2, Dm, Dm)
Shp4.Fill.ForeColor.SchemeColor = 5
[COLOR="Navy"]Set[/COLOR] Shp5 = ActiveSheet.Shapes.AddShape(msoShapeOval, 20 + Dm * 4, 20 + [a2] / 2 - Dm / 2, Dm, Dm)
Shp5.Fill.ForeColor.SchemeColor = 6
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top