none
Show hidden sheet by clicking on the picture RRS feed

  • Question

  • Hi Excel gurus,

    Is there a way to open a hidden sheet by clicking on the picture.

    Instance:

    In my Excel workbook (Sheet1), there is a picture called "Picture1", and sheet 3 is hidden. The Sheet3 should be open when you clicked on the "Picture1"

    Thank you


    BABA

    Thursday, May 24, 2018 8:51 AM

All replies

  • Hello RP Reddy,

    You could set Shape.OnAction to make excel run a macro while clicking the shape. In the macro, you could try to hide/show worksheet.

    Here is the example.

    Sub Test()
    Worksheets(1).Shapes("Picture 1").OnAction = "HideSheet3"
    End Sub
    
    'Function must be added in module
    Function HideSheet3()
    Worksheets("Sheet3").Visible = False
    End Function

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 24, 2018 10:02 AM
  • Hi Terry,

    Thank you so much for your code.

    I tried (below)

    

    Sub Test()
    Worksheets(1).Shapes("Picture1").OnAction = "HideSheet3"
    End Sub

    'Function must be added in module
    Function HideSheet3()
    Worksheets("Sheet3").Visible = False
    End Function


    BABA

    Thursday, May 24, 2018 2:19 PM
  • Hello RP Reddy,

    It seems the code  failed to find a shape named "Picture 1" in the first worksheet in the workbook. 

    I would suggest you confirm if there is a shape named "Picture 1" or you could rename a shape as "Picture 1".

    Besides, if you have multiple worksheets, I would suggest you use worksheet name to get the worksheet.

    Try

    Sub Test()
    Worksheets("Sheet1").Shapes("Picture 1").OnAction = "HideSheet3"
    End Sub

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 25, 2018 1:47 AM