Groups in Excel VBA

M

MarkBradshaw

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?
 
V

Vic Eldridge

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top