+ Reply to Thread
Results 1 to 5 of 5

The name of a shape is in a cell and I want to indirectly reference it in vba

  1. #1
    Registered User
    Join Date
    01-25-2018
    Location
    london
    MS-Off Ver
    365
    Posts
    43

    The name of a shape is in a cell and I want to indirectly reference it in vba

    Hello amazing people of the VBA world, I'm slowly getting better at VBA and understanding it but i'm getting a bit stuck on this particular thing and unsure why it's not working.

    I've been able to indirectly reference a cell with a shape name before in order to show/hide a given shape so i know the code i wrote works, however when I try to apply it to this particular bit of code it doesn't work.

    The shape I want to move is called "rya1" and the cell location to move it to is located in "AH24". When I directly reference the shape name this code works perfectly:
    Please Login or Register  to view this content.
    I want the shape name (because it will change) in cell "AH25" and then for the VBA to pull the name from that cell and use that shape in the code - this is what I wrote but it wasn't working.

    Please Login or Register  to view this content.
    Anyone any ideas why please?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: The name of a shape is in a cell and I want to indirectly reference it in vba

    Try

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

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: The name of a shape is in a cell and I want to indirectly reference it in vba

    As Andy made clear already rest of your code looks like this.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    01-25-2018
    Location
    london
    MS-Off Ver
    365
    Posts
    43

    Re: The name of a shape is in a cell and I want to indirectly reference it in vba

    Thanks Both of you that worked perfectly! It appears I had a rogue .Range!

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: The name of a shape is in a cell and I want to indirectly reference it in vba

    Thanks for feedback and rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as 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. Inserting Cell Reference Inside Merged Shape
    By EdwardSnowden in forum Excel General
    Replies: 0
    Last Post: 08-16-2019, 09:34 AM
  2. Dim variable in VBA indirectly, by reference
    By Enterplan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2018, 02:27 PM
  3. [SOLVED] Show shape on cell select, Hide shape when cell is deselected
    By brendangroff in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-25-2016, 03:36 PM
  4. Indirectly reference a named array?
    By XLOOKUP in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 08-24-2016, 02:54 PM
  5. How to load or Reference a Sheet Indirectly
    By Alac61 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2015, 06:23 AM
  6. Reference a cell indirectly for function
    By undergraduate in forum Excel General
    Replies: 3
    Last Post: 05-05-2010, 09:29 AM
  7. Replies: 5
    Last Post: 10-26-2005, 03:05 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