+ Reply to Thread
Results 1 to 5 of 5

VBA formula to ungroup all image files on entire worksheet

  1. #1
    Registered User
    Join Date
    06-30-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    13

    VBA formula to ungroup all image files on entire worksheet

    Hi All,

    I'm looking for a bit of code to insert into another piece of code - so that I can use the one macro to do both tasks.

    I would like to be able to ungroup all image objects on an entire worksheet using a macro. To do this manually you would have to select all objects, then ungroup and repeat this command until you cannot ungroup anymore. This can be very annoying and I would also like to protect the sheet - and to ungroup all images on a protected sheet in excel 2003 - means you have to manually select each object and then ungroup.

    I have attached a worksheet for you to look at - there are 3 tabs: 'All images'; 'test-a'; 'test-b'. For the original piece of code to work efficiently - all the image objects have to be ungrouped into their original name - as opposed to the new group name that does not appear in the original 'All image' tab.

    To see what I mean - if you use the macro in the attached file to 'count' all the images - you will see that sheet 'test-a' performs the count; however sheet 'test-b' does not. This is because a few of the images files have been grouped in sheet 'test-b' and have been given another name that does not appear on the 'All image' tab.

    Is it possible to add another piece of code to ungroup all the images in every tab (or every tab excluding the 'All images' tab) before using the following macro:

    Please Login or Register  to view this content.
    I hope this makes sense.

    Thanking you in advance.

    Kind Regards,
    MKKEXCEL
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA formula to ungroup all image files on entire worksheet

    Try this:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-30-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: VBA formula to ungroup all image files on entire worksheet

    This formula is fantastic for the attached workbook, thanks once again - however is there anyway that instead of having to copy the code:

    Please Login or Register  to view this content.
    for each group within a group - that there is a way that you are able to ungroup any number of groups within a group.

    If this is not possible - you can always run the above VBA until the answer remains the same - however it would be good if you just had to run the above code the single time.

    I hope this makes sense.

    And thanks again.

    Kind Regards,
    MKKEXCEL

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA formula to ungroup all image files on entire worksheet

    Hmm, maybe with an overlapping loop...

    Please Login or Register  to view this content.

    At some point it goes through all the shapes and there are no more groups so it would exit out the bottom instead of starting again.

  5. #5
    Registered User
    Join Date
    06-30-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: VBA formula to ungroup all image files on entire worksheet

    Genius - works a treat!!

    Many thanks for all your time and effort with the above, much appreciated. Another problem swiftly solved.

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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