+ Reply to Thread
Results 1 to 6 of 6

Deleting shapes not working

  1. #1
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    MS-Off Ver
    Office 365 For Mac Excel Version 16.88
    Posts
    143

    Deleting shapes not working

    I've got a workbook that I use to create other workbooks, it basically saves as a new workbook and saves it to a directory and with a file name based on information entered into the workbook. It also deletes two buttons I put in that have other macros linked to in order to prevent them being accidentally run again these being Rounded Rectangle 1 and Rounded Rectangle 2

    This was my code
    Please Login or Register  to view this content.
    This worked fine but I needed to change two things.

    1. I didn't want the workbook that generates the other workbooks to be saved. Instead it should be closed without saving (this is because I have another macro that runs whenever the workbook is saved).
    2. If a cell, B1, in the generator workbook was blank, I didn't want it to create the new workbook.

    So I changed the code to this:

    Please Login or Register  to view this content.
    What happens now is the generator workbook isn't saved, which is correct, and if B1 is empty it won't save it as a new workbook which is also correct. However when B1 has data in it, it does create the new workbook but the buttons, rounded rectangle 1 & 2 are not deleted.

    I can't work out what I've done that means that everything works as it should but the buttons aren't deleted.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Deleting shapes not working

    Hi,

    It looks to me as though you save the workbook as a new name, then delete the rectangles but then you close the workbook without saving it, so the rectangles will still be there when you reopen it.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    MS-Off Ver
    Office 365 For Mac Excel Version 16.88
    Posts
    143

    Re: Deleting shapes not working

    Ahh I thought that by saving the new workbook as a new name, that new workbook became the active one and so I was deleting them off of the new one. If I move the delete commands to before the SaveAs that now works.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Deleting shapes not working

    You were deleting them from the new one, but you then didn't save it again after making those changes, so they returned when you reopened the workbook.

  5. #5
    Forum Contributor
    Join Date
    11-20-2008
    Location
    UK
    MS-Off Ver
    Office 365 For Mac Excel Version 16.88
    Posts
    143

    Re: Deleting shapes not working

    Doh!

    Yes, I see it now. Thanks again.

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Deleting shapes not working

    You're welcome. Please remember to mark the thread solved.

+ 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] Shapes and Deleting Shapes
    By rob_h in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-24-2017, 10:07 AM
  2. Working with shapes - naming and deleting
    By JusCor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2012, 12:03 AM
  3. Deleting Shapes
    By Dean81 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-25-2011, 01:25 PM
  4. Deleting Specific Shapes
    By FrankStallone in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-15-2006, 01:43 AM
  5. [SOLVED] Deleting Shapes
    By aftamath in forum Excel General
    Replies: 5
    Last Post: 11-04-2005, 08:45 PM
  6. [SOLVED] deleting all shapes and lines
    By thadpole in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-28-2005, 06:05 PM
  7. Deleting Shapes in a worksheet
    By Glen Mettler in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-11-2005, 06:32 AM

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