+ Reply to Thread
Results 1 to 7 of 7

Reference to a copied shape

  1. #1
    Registered User
    Join Date
    06-18-2015
    Location
    Austria
    MS-Off Ver
    2010
    Posts
    15

    Reference to a copied shape

    Hi,
    I'm new to the forum and I've got a question. I want to copy an existing grouped shape and assign an object reference to this new shape.
    Simply copying works fine with this code:
    Please Login or Register  to view this content.
    This copies Group1 to D5.

    However, I need a reference to this new object - so something like this:
    Please Login or Register  to view this content.
    ... which isn't working. So how can I do this?

    Thank you

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Reference to a copied shape

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    To add a file to a new post

    To add a file to an existing post.

  3. #3
    Registered User
    Join Date
    06-18-2015
    Location
    Austria
    MS-Off Ver
    2010
    Posts
    15

    Re: Reference to a copied shape

    Ok, I don't think it's very helpful with this particular issue but here is the file: test.xlsm

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Reference to a copied shape

    Will this work for you?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-18-2015
    Location
    Austria
    MS-Off Ver
    2010
    Posts
    15

    Re: Reference to a copied shape

    Yes, thank you very much, I can work with that. I now work with the following:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Reference to a copied shape

    Hi kaktus018 and welcome to ExcelForum,

    You will usually get a much better and quicker response if you post a sample workbook. Your sample workbook was most helpful.

    When cloning shapes I like to associate the name of the cloned shape with the cell location .e.g. "GroupH5".

    Try the following which worked with your sample workbook:
    Please Login or Register  to view this content.

    If you need to delete the cloned shapes, and keep the MASTER shape, try this:
    Please Login or Register  to view this content.
    Lewis

  7. #7
    Registered User
    Join Date
    06-18-2015
    Location
    Austria
    MS-Off Ver
    2010
    Posts
    15

    Re: Reference to a copied shape

    Thanks for the response Lewis. Quite some code you wrote there .
    What I needed was the copied object itself, which is generated in the constructor of a class. This object is then stored as a class variable. This is why I needed a reference to the copied shape. The positioning is then done with a mehod of this class.
    I hoped there is a direct way of setting a reference to the copied shape, but the workaround via its name is fine for me (I needed to name it anyway). I mark this as solved.
    Thanks for the responses.

+ 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] Copied Shape with Macro: Reassign New Macro
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2014, 10:08 PM
  2. Trying to get macro to reference newly copied worksheet
    By creuther in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-29-2011, 10:54 PM
  3. Reference Cell Hold position even when copied
    By ssword in forum Excel General
    Replies: 9
    Last Post: 11-01-2010, 12:19 PM
  4. How do I get a worksheet reference to increment when copied
    By RAF in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-02-2006, 04:15 PM
  5. Cell reference update when copied and pasted
    By Dave in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-05-2006, 03:55 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