+ Reply to Thread
Results 1 to 5 of 5

Need help with shape appear & disappear

  1. #1
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Need help with shape appear & disappear

    Hello all,

    I am using Office 2016 and I am not a programmer. I can figure things out most of the time but this time I can't.

    Here is what I'm trying to do. I have an excel macro enabled sheet with a label and a shape called Label1 and Shape1. I want Shape1 to be invisible until the user mouse's over Label1

    Here is the code:

    Option Explicit

    Sub ShowShape()
    Sheet1.Shapes("Shape1").Visible = msoCTrue
    End Sub

    Sub HideShape()
    Sheet1.Shapes("Shape1").Visible = msoFalse
    End Sub


    Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ShowShape
    End Sub

    When I try to run it I get this error message. What am I missing?

    Why do I want the shape to be invisible? I have another shape which is visible and I want Shape1 to be on top of it so when they mouse over the other shape, Shapo1 appears

    Thanks for any help. I think I'm close but not there yet
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Re: Need help with shape appear & disappear

    Forgot the attachment, and the shape's actual name is RoundedRectangle1
    Attached Files Attached Files

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need help with shape appear & disappear

    This works for me. Two labels, one to hide, one to show.
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Re: Need help with shape appear & disappear

    Thank you, that works beautifully but your VBA looks the same as mine. What was I missing? I want to learn from my mistakes. Thanks again for the help!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need help with shape appear & disappear

    I didn't change anything. Just added a label and code to goat it, formatted the labels and moved things around.



    And, you're welcome. Thanks for the rep.

+ 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. Making a shape disappear
    By Johnegee in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-05-2021, 08:06 AM
  2. Replies: 0
    Last Post: 10-01-2020, 05:40 AM
  3. Shape buttons - Switch background image of shape on click and exit - referenced jpg
    By ApatheticAndrew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2015, 08:06 AM
  4. Replies: 13
    Last Post: 12-10-2013, 12:51 PM
  5. [SOLVED] Use a button to control a macro that inserts an image into a shape or resets the shape
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 04:41 PM
  6. Replies: 0
    Last Post: 11-30-2012, 01:29 PM
  7. Need a shape to appear and disappear
    By Frank Curry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2012, 05:32 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