+ Reply to Thread
Results 1 to 5 of 5

Grouping charts and shapes programatically

  1. #1
    Registered User
    Join Date
    01-15-2016
    Location
    New England
    MS-Off Ver
    2007
    Posts
    29

    Grouping charts and shapes programatically

    I have code that creates many Charts.

    It puts a Rectangle Shape behind Charts that show related information; So the Rectangle creates a nice frame around Charts that should be viewed together.


    I want to also group the Charts and Rectangle frames that way they can be easily moved and copied by the user afterward.


    How do i do this without selecting the objects and without using the range property as both of these would be poor programming?... this code will be outputting 1000's of plots; any excess calls to access the sheet severely slows it down.

    in the code i have direct access to all the individual Chart and Rectangle objects... for instance
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Grouping charts and shapes programatically

    Something like this will group the 2 shapes. You just need to determine which rect and med_plot items go together.

    Please Login or Register  to view this content.
    Why do you think using the Range property is poor programming?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-15-2016
    Location
    New England
    MS-Off Ver
    2007
    Posts
    29

    Re: Grouping charts and shapes programatically

    I am not trying to get into programming debate in this thread... So please save yourself of the time of typing out a counter argument if you have one; I am set in my ways, even if your right its not going to change my opinion.

    but here is why I really don't like using range, and especially selection.

    I make programs that are used mostly by people who are not me and are constantly being changed and updated. Mostly they are data parsing programs where I get an XL file or text file and it spits out a nice data report. I have rules that I follow when I make a program.

    1. absolute minimal dependence on the format of the data being inputed. The program should have intelligence to find and gather all the relevant information.

    2. Only use dynamic arrays. The program should always work regardless of the size of data input.

    3. Never show an empty Input Box. The program should always show a very good guess of what the user is going to input. This saves time and headaches if someone has to use the program over and over.

    4. Never show Modal forms if possible. Modal forms are annoying. I like being able to scroll around on the excel and click and off different forms.

    5. Access the excel sheet the minimum amount. Makes the code faster, and easier for me to update.

    6.Never use Selection. Its slow. It can make wacky things happen if the user accidentally clicks the sheet.


    So using the RANGE property usually implies that I already know the size and location of the sheet I need to access... This conflicts with rule #1.

    The only time I do use RANGE is when I am setting borders, colors, merging cells at the output stage of things. But, I do it like this:
    Please Login or Register  to view this content.
    This way it is still dynamic.

    I might be confused with how RANGE works with objects. My first assumption was that
    Please Login or Register  to view this content.
    would grab everything between those object locations, which is what I do not want. But after a closer look I think this not the case.
    Last edited by tonyd5; 07-22-2018 at 06:15 PM.

  4. #4
    Registered User
    Join Date
    01-15-2016
    Location
    New England
    MS-Off Ver
    2007
    Posts
    29

    Re: Grouping charts and shapes programatically

    How do I add points to your green bar thing

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Grouping charts and shapes programatically

    The range object in this case takes an array of objects to group.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    There is also the Add Reputation star, at the bottom left of each post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA grouping shapes by position
    By bluphoto in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2014, 01:23 PM
  2. Looking for shapes& charts tutorials
    By SIMBAtheCAT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2014, 01:15 AM
  3. 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
  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
  6. Programatically control a shapes TextBox
    By Francis Brown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2005, 02:05 PM
  7. [SOLVED] Bubble Charts - Different Shapes
    By [email protected] in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-25-2005, 04:06 PM

Tags for this Thread

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