Results 1 to 3 of 3

Need help with grouping shapes using an array

Threaded View

plucier Need help with grouping... 10-12-2013, 06:00 PM
millz Re: Need help with grouping... 10-13-2013, 12:09 AM
plucier Re: Need help with grouping... 10-13-2013, 12:22 AM
  1. #1
    Registered User
    Join Date
    10-12-2013
    Location
    California
    MS-Off Ver
    Excel 2010 (Mac OS X)
    Posts
    2

    Need help with grouping shapes using an array

    Hi all,

    I need to group a decent sized selection of shapes (25) and apply a name. I've been successful doing this using the long, brute force approach below:

    wsDwg.Shapes.Range(Array(myRow & "TITLE", myRow & "CP", myRow & "CPK", myRow & "CHART", myRow & "BAR1", myRow & "BAR2", myRow & "BAR3", myRow & "BAR4", myRow & "BAR5", myRow & "BAR6", myRow & "BAR7", myRow & "BAR8", myRow & "BAR9", myRow & "BAR10", myRow & "BAR11", myRow & "BAR12", myRow & "BAR13", myRow & "BAR14", myRow & "BAR15", myRow & "BAR16", myRow & "BAR17", myRow & "BAR18", myRow & "BAR19", myRow & "BAR20", myRow & "MINLINE", myRow & "MAXLINE", myRow & "BlockCover")).Group.Name = myRow & "BlockGroup"
    As you can see, this is messy and prone to typos. If I need to change anything it will be easy to break and difficult to troubleshoot. Since the call is using the "Array" function, I would like to build a 1-dimensional array and just call that instead. Here's the array I built:

    shapeArray(1) = myRow & "TITLE"
        shapeArray(2) = myRow & "CP"
        shapeArray(3) = myRow & "CPK"
        shapeArray(4) = myRow & "CHART"
        For i = 1 To 20
            shapeArray(i + 4) = myRow & "BAR" & i
        Next
        shapeArray(25) = myRow & "BlockCover"
    The problem is I've not been successful calling my "shapeArray" in the Shapes Range function from the original line. Can anyone help with the correct syntax to use in this situation?
    Last edited by alansidman; 10-13-2013 at 01:29 AM. Reason: Code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Shapes.Range(Array(...))
    By jdaw1_SG in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-03-2011, 05:01 AM
  2. determining selection is array of shapes
    By a1s2d3f4 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-07-2009, 11:18 AM
  3. checking if shapes exist and grouping them
    By gummi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-21-2008, 11:12 AM
  4. Grouping Shapes
    By LaraBee in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-14-2007, 03:55 PM
  5. Shapes Range Array
    By Bubb in forum Excel General
    Replies: 1
    Last Post: 04-10-2006, 06:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1