+ Reply to Thread
Results 1 to 5 of 5

How to uniquely identify selected chart in VBA

  1. #1
    Forum Contributor
    Join Date
    09-28-2007
    Location
    New York, NY
    MS-Off Ver
    2007
    Posts
    120

    How to uniquely identify selected chart in VBA

    Hi all,

    I'm trying to create a macro to delete all charts on a sheet EXCEPT for the one that is selected prior to running the macro. How to i find a unique ID for each chart on the page. My plan was to grab the unique ID of the selected chart and then loop through all charts, compare that ID, and if it doesn't match, delete the chart in the loop. I can't use .Name because there are often charts with the same exact name in the sheet (I think this usually happens when you make a copy an existing chart that you manually named). Any ideas?

    Thanks
    Last edited by MCCCLXXXV; 04-27-2012 at 03:03 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: How to uniquely identify selected chart in VBA

    Hi

    Select 1 chart and try this code to delete all other charts in the active worksheet:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-28-2007
    Location
    New York, NY
    MS-Off Ver
    2007
    Posts
    120

    Re: How to uniquely identify selected chart in VBA

    Thanks lecxe. That worked perfectly!

  4. #4
    Forum Contributor
    Join Date
    09-28-2007
    Location
    New York, NY
    MS-Off Ver
    2007
    Posts
    120

    Re: How to uniquely identify selected chart in VBA

    anyone know if there is a way to make this such that the user could select multiple charts prior to running the macro and delete all charted except those selected?

    Thanks

  5. #5
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: How to uniquely identify selected chart in VBA

    Hi again

    Select 1 or several charts in the active worksheet and try:

    Please Login or Register  to view this content.

+ 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