+ Reply to Thread
Results 1 to 4 of 4

If shapes exist then delete

  1. #1
    Registered User
    Join Date
    03-31-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    68

    If shapes exist then delete

    Hi all,

    I need to amend my code to check if shapes exist on my worksheets before the delete.

    Because the code below is deleting the selected cell if there are no shapes on the worksheet.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If shapes exist then delete

    Try
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: If shapes exist then delete

    Hi,

    Use the Shapes collection object and count that then test for a count >0

    e.g.

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    03-31-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: If shapes exist then delete

    You both had the same idea.

    Works perfect thank you.

+ 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] How to delete all Shapes in all WS within a WB
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-16-2013, 10:52 PM
  2. Delete Shapes in Range
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2009, 02:40 AM
  3. Delete Shapes Error 400
    By dreicer_Jarr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2009, 01:55 PM
  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. Delete grouped shapes?
    By Dr.Ile in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2006, 06:00 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