+ Reply to Thread
Results 1 to 7 of 7

Delete Object when Object number unknown

  1. #1
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115

    Delete Object when Object number unknown

    i recorded the following macro to delete and object on a worksheet, yet the object number is not always the same.

    Please Login or Register  to view this content.
    i tried using
    Please Login or Register  to view this content.
    yet received an error. any suggestions on how to select an object when the object name (it will always be "Object #") is unknown?

  2. #2
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92
    If you don't have a way of identifying which object you want to select then your in a bit of difficulty.

    each shape is in the 'shapes' collection. You can cycle through the shapes easily enough with a couple of methods:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    You could put in yes/no message box or something so that you stop when the correct shape is selected I suppose.

    What is it you are trying to do exactly?

  3. #3
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    hello chergh

    i'm trying to reset a sheet that contains data, formula and objects. i'm using clearcontents to reset the sheet, yet the object is not cleared with this.

    i guess your first code will identify the objects on the sheet, such that i can then clear it?

  4. #4
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92
    If you just want to delete every shape in your spreadsheet then use:

    Please Login or Register  to view this content.
    If you want to clear every worksheet in your workbookof shapes use:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    i want to delete every shape in the active worksheet only... so if i change "worksheets("Sheet1")" to activesheet it should do the trick?

  6. #6
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92
    Yeah it should do.

  7. #7
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    it did. thanks for your help chergh

+ 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