+ Reply to Thread
Results 1 to 9 of 9

show hide shape to a cell according to its value

  1. #1
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Talking show hide shape to a cell according to its value

    hello am new at this and i need some help please.
    i have this worksheet

    Untitled.jpg

    i want whenever i insert number 30 in cells D3 to D62 and cells R3 to R62
    the RCD Shape to apear to it. (RCD is a my group shape).
    i tried with this code but nothing happens

    if you see the example i insert manually the RCD shape to cells R4,R5 etc

    Please Login or Register  to view this content.
    thank you
    Last edited by vlady; 03-13-2015 at 03:58 AM.

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

    Re: show hide shape to a cell

    Try the worksheet_change event instead of worksheet_calculate

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell

    it doesn't work! when i enter a slide different code in an empty sheet it just shows the rcd but on my sheet it brings an error

    Please Login or Register  to view this content.
    Last edited by vlady; 03-13-2015 at 03:58 AM.

  4. #4
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell

    Also in that sheet i have more code i don't know if this affects the new code
    Last edited by pavlos_x; 03-11-2015 at 03:29 PM.

  5. #5
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell

    Some help please?

  6. #6
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell

    i attached my example thank you. if it asks for code is 12341 in both cases
    Attached Files Attached Files
    Last edited by pavlos_x; 03-12-2015 at 08:32 AM.

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

    Re: show hide shape to a cell according to its value

    Hi pavlos_x,

    There is a discussion of how Shapes work in this post, and a solution to your problem in the next post.

    Thank you for uploading the example file. It would have been impossible for me to try to help you without the file.

    In order to understand the solution, you have to understand how Shapes work on a Worksheet:

    a. In order to access a Shape using VBA (unless the Shape is SELECTED), the Shape Name must be UNIQUE on that Sheet.

    b. When creating Shapes using Excel Drawing Tools, or Forms Controls Tools, or Active X Tools, Excel creates unique Shape Names.

    c. When copying shapes created in b. above, Excel will increment the number associated with the Shape Name. For example when cutting and pasting Forms Control 'Button 1', the Shape display in the NEW SHAPE will remain 'Button 1', but the NAME of the Shape will be 'Button2'.

    d. Once the User Renames a Shape then Excel DOES NOT increment the the number associated with the Shape Name. For example Forms Control 'Button 1' is created, and then renamed 'Button 11'.

    When cutting and pasting 'Button 11', the Shape display in the NEW SHAPE will remain 'Button 11', and the NAME will REMAIN 'Button11'. If VBA is not involved this in not a problem for Drawing Objects or Forms Control Shapes.

    NOTE: This is NOT TRUE for 'Active X' Controls. 'Active X' controls maintain their UNIQUE names when cutting and pasting. If 'Active X' control names are NOT UNIQUE, unpredictable results can and will occur.

    e. When accessing a Shape by name using VBA, the Shape name MUST be UNIQUE on the Sheet. Excel maintains a list of Shape Names (probably in the order they were created). When requesting a Shape name, Excel matches the first matching name that is found. If there were three Shapes 'ABC' on the Sheet, Excel would reference the same 'ABC' each time 'ABC' was requested. The other 2 'ABC' shapes would never be accessed.

    Lewis

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

    Re: show hide shape to a cell according to its value

    In order to create UNIQUE Shape names, some kind of system is required. The two most common systems I use are:
    a. Sequential numbering system (e.g. 'RCD01', 'RCD02', etc.)
    b. Cell Reference system (e.g. 'RCDH9', RCDH10', etc.)

    In your case, there is a MASTER Shape that you created, called 'RCD'. Your application lends itself the the 'Cell Reference System'. I deleted all your 'RCD' (Clone) Shapes, except for the MASTER shape. In cells 'H3' thru 'H62' I created clone 'RCD' shapes with names 'RCDH03' thru 'RCDH62'. To do this I used the following macros:
    a. DeleteAllRCDCloneCellsOnActiveSheet() - needed only during Software Development.
    b. CreateShapesRCD() -needed only during Software Development.
    c. DisplayOrHideShapesRCD() - need during Software Development and in Production if the Shape Visibility gets out of sync due to some kind of corruption.

    In an ordinary code module such as 'Module1':
    Please Login or Register  to view this content.
    When you change the values in Column H, you need the following code in Worksheet_Change() in the Sheet module. I took the liberty of updating your existing code:
    Please Login or Register  to view this content.
    All the above code is included in the attached file based on your uploaded file.

    Lewis
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell according to its value

    wow this is amazing!! thank you so much. you did so much work on it. the way that these things work is unbelievable, for a small process two pages of coding!!!

+ 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. Show/Hide Group of shapes while keeping individual shape visibility settings
    By Voldenite in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2015, 03:12 AM
  2. Hide/show shape on Sheet1 based on cell value in Sheet2?
    By Guple in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-05-2013, 02:12 PM
  3. Show/Hide Shape VBA
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2013, 09:03 AM
  4. moving mouse over a cell to show hid a shape
    By aryanarch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2011, 12:06 PM
  5. [SOLVED] Show & Hide Shape in a Sheet
    By Pete Csiszar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2005, 10:07 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