views:

55

answers:

1

So I have this global mapping scheme, and each country on it are individual shapes. I learned how to manipulate colors/fill based on certain criteria. So the way I do this, or the way I know how is one shape/object at a time.

For example USA is "C_USA", Canada is "C_CAN", etc.

So is there a way I can define countries into groups?? ie. I would like to put USA, CAN and MEX into a NorthAmerican group so that I can just call a sub for the group instead of all three individually.

It really stinks when I am over in Europe! :)

Thanks!

+1  A: 

You can group shapes together as follows:

Dim NA_Group As Shape
Set NA_Group = ActiveSheet.Shapes.Range(Array("C_CAN", "C_USA", "C_MEX")).Group

Note that once you have done this once, you can no longer access the individual shapes by name without first ungrouping them, or by addressing them within the NA_Group.

Once you have them grouped, you can treat the whole group like a single shape:

NA_Group.Fill.ForeColor.RGB = RGB(255, 255, 0)
NA_Group.Line.ForeColor.RGB = RGB(255, 0, 0)
'// etc.
e.James
thanks very much!! what is the code for ungrouping them? set NA_Group = nothing??
Justin
You're welcome! To ungroup them, use NA_Group.Ungroup See http://msdn.microsoft.com/en-us/library/aa213605(office.11).aspx for more info.
e.James