Results 1 to 5 of 5

VBA grouping shapes by position

Threaded View

  1. #1
    Registered User
    Join Date
    12-10-2008
    Location
    Aberdeen
    MS-Off Ver
    MS365 VER 2308
    Posts
    85

    VBA grouping shapes by position

    Can anyone help me with setting up and adding shapes to groups depending on their position on the worksheet. They are all pasted dynamically and regularly deleted and recreated, so usign their ID or name is difficult. They are a mixture of textboxes, arrows and pictures.

    Hopefully the below code snippet will let you see what I'm trying to do

    Sub groupshapes()
    Dim myshape As Object
    ' groups:
    '  1   2   3
    '  4   5   6
    
    Group = 0
    
    For Each Object In ActiveSheet
        Select Case Object.Left
        Case 0 To Range("P1").Left: Group = 1
        Case Range("Q1").Left To Range("AF1").Left: Group = 2
        Case Range("AH1").Left To Range("AV1").Left: Group = 3
        End Select
        If Object.Top > Range("A27").Left Then Group = Group + 3
        
        'Add object to relevant group - no idea how :)
    Next
    
    End Sub
    Last edited by bluphoto; 11-19-2014 at 12:16 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need help with grouping shapes using an array
    By plucier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2013, 12:22 AM
  2. Replies: 5
    Last Post: 12-06-2012, 06:52 PM
  3. [SOLVED] position of the + box when grouping columns
    By steve@stanley in forum Excel General
    Replies: 3
    Last Post: 11-03-2012, 06:28 AM
  4. 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
  5. Grouping Shapes
    By LaraBee in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-14-2007, 03:55 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