ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Groups in Excel VBA (https://www.excelbanter.com/excel-programming/341443-groups-excel-vba.html)

MarkBradshaw

Groups in Excel VBA
 
I have a group of shapes in Excel, all nicely labelled and what i want to be
able to do is rotate one specific shape inside that group and NOT the entire
group itself.

More-over i want to be able to copy and paste this group of shapes and be
able to dictate the rotation said shape for each group individually.

I.e. Two groups of shapes (copy and paste job) called "Group 1" and "Group
2" BOTH contain a shape called "Needle" and I wan to be able to rotate
Group1.Needle or Group2.Needle as I see fit.

Make sense?

Any ideas?



Vic Eldridge[_3_]

Groups in Excel VBA
 
Hi Mark,

Using Excel 2003, you can use the following code to rotate a shape that
begins with the letters "Needle". IIRC, in previous versions of Excel you
had to ungroup the group first, rotate the individual shape, then regroup the
group. Also, Excel 2003 renames the individual shapes within a group when
you make a copy of that group. That was not the case in earlier versions I
believe.

With ActiveSheet.Shapes("Group 1")
For i = 1 To .GroupItems.Count
If Mid(.GroupItems(i).Name, 1, 6) = "Needle" Then
.GroupItems(i).Rotation = 123
End If
Next i
End With



Regards,
Vic Eldridge





"MarkBradshaw" wrote:

I have a group of shapes in Excel, all nicely labelled and what i want to be
able to do is rotate one specific shape inside that group and NOT the entire
group itself.

More-over i want to be able to copy and paste this group of shapes and be
able to dictate the rotation said shape for each group individually.

I.e. Two groups of shapes (copy and paste job) called "Group 1" and "Group
2" BOTH contain a shape called "Needle" and I wan to be able to rotate
Group1.Needle or Group2.Needle as I see fit.

Make sense?

Any ideas?




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

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