+ Reply to Thread
Results 1 to 7 of 7

Deleting a specific AutoShape

  1. #1
    Registered User
    Join Date
    09-13-2008
    Location
    Australia
    Posts
    12

    Deleting a specific AutoShape

    i have a macro which creates a new shape, which displays a message that the current process is waiting to finish. i have a second macro which deletes this shape after the process is complete. However the name of the shape changes everytime it is created and the deleting macro fails. Is there a way to name the new shape when it is created so that i can refer to it when i delete it.

    I have other shapes on the page so deleting all shapes is not an option.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why not make the code more efficient so that it is faster? You are obviously activaring sheets which is more than likely unnecessaary.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I've just checked the code & you aren't actually naming the shape. Try this changed code, but I still think it would be unnecessary with better coding.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    possible solution

    You should be able to capture a reference to the object you have just created. When the object is created, it is selected by default.

    Please Login or Register  to view this content.
    Last edited by Mallycat; 10-05-2008 at 03:18 AM. Reason: layout

  5. #5
    Registered User
    Join Date
    09-13-2008
    Location
    Australia
    Posts
    12
    thanks roy it worked great.
    when you say activating sheets slows my code what did u mean by that?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by zinny View Post
    thanks roy it worked great.
    when you say activating sheets slows my code what did u mean by that?
    You autoshape mentions that the user will see sheets changing, this seems to mean that your code is selecting sheets and/or ranges. This will slow the operation of the code and is not usually necessary.

    Try this code in a Standard Module, you can run this code with any sheet active & the text will be placed in A1 of Sheet3 without having to select sheet3
    Please Login or Register  to view this content.
    Last edited by royUK; 10-05-2008 at 04:53 AM.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Slight tweak to Mallycat's code in order to prevent selection of shape.

    The macro recorded code incorporates the selection of the shape when added. When altering the code we can remove the need for selection and assign a reference in 1 go.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ 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. Deleting All BUT Specific Rows
    By pcargila in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-16-2008, 09:24 AM
  2. Deleting Specific Rows
    By phillim in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2008, 06:12 PM
  3. Deleting Specific Rows
    By Desi_bhai in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-18-2007, 09:33 AM
  4. Deleting rows with a specific value
    By favoritepsalm1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2007, 10:20 AM
  5. Replies: 7
    Last Post: 06-26-2007, 11:33 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