+ Reply to Thread
Results 1 to 9 of 9

Can't create macro for deleting objects

  1. #1
    Registered User
    Join Date
    10-02-2013
    Location
    Santa Rosa, CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Can't create macro for deleting objects

    I can't create a macro to delete objects. Someone solved this one for me a while back. I'm in a different file, and can't get it to work. I tried creating the macro manually and in visual basic. Sub Del Object() ActiveSheet.DrawingObjects.Cut But neither method works. File attached.
    Attached Files Attached Files

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Can't create macro for deleting objects

    I don't see the macro you are referring to.

    And maybe also attach the file that is working.

  3. #3
    Registered User
    Join Date
    10-02-2013
    Location
    Santa Rosa, CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Can't create macro for deleting objects

    The macro is in "Macros" on the main ribbon. Or in the "General" screen in visual basic. It is called RemoveObjects. I have re-attached the file. There are three macros. Two (the two that have buttons) work fine. But I can't get the one to remove objects to work.... either my creating it manually in Excel or with visual basic. I no longer have the file that worked.
    Attached Files Attached Files

  4. #4
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Can't create macro for deleting objects

    Try adding the line;
    Please Login or Register  to view this content.
    to your code.

  5. #5
    Registered User
    Join Date
    10-02-2013
    Location
    Santa Rosa, CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Can't create macro for deleting objects

    Nope. Got a "Runtime error '424'

  6. #6
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Can't create macro for deleting objects

    If you run the code without the delete line, do all the objects in the sheet get selected?

  7. #7
    Registered User
    Join Date
    10-02-2013
    Location
    Santa Rosa, CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Can't create macro for deleting objects

    Excellent question. I have tried it with and without "delete" and "cut," and neither work AT ALL... that is, nothing is even selected. The earlier macro that "worked" didn't completely work. It went as far as selecting and I had to hit "backspace." Now I can't even get it to do that. I know it's just a few keystrokes via F-5, but I was hoping to string the three macros together, and do all the work with one button. Thanks for working on this with me.

  8. #8
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Can't create macro for deleting objects

    But maybe you are trying to run it when there are NO objects available to select, therefore error.

    Place an object and then try the code.

  9. #9
    Registered User
    Join Date
    10-02-2013
    Location
    Santa Rosa, CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Can't create macro for deleting objects

    I checked. There are plenty of objects. I also tried selecting the entire sheet (excel macro) to no avail.

+ 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. [SOLVED] Can't create macro for deleting objects
    By sperrysperry in forum Excel General
    Replies: 4
    Last Post: 10-21-2018, 04:13 PM
  2. [SOLVED] Macro Is Deleting all Pictures and ActiveX Objects
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-24-2014, 01:26 PM
  3. Issue with deleting objects
    By sbernard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2011, 12:03 PM
  4. Deleting objects using Macro
    By dreicer_Jarr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2008, 02:55 PM
  5. Deleting objects within a certain range
    By JohnnyBGood in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2007, 10:11 PM
  6. Deleting and resizing the calendar objects
    By Bobmckelvy in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 09-16-2006, 08:31 PM
  7. [SOLVED] deleting objects
    By Larry Sartoris in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2005, 01:05 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