• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Hide and Show Images

Matt F

New Member
Is it possible to Show and Hide images on a worksheet?

I have a worksheet where a user can insert a screenshot. I would like to give the option to show and hide that image or images in a range of cells.

The macro hides and shows the rows fine but the image remains. I would like for the image to also be hidden so it wont overlap other content.

I wont know the name of the image so cant always reference "Picture 1" or something similar in the code.

Code:
Sub show_hide()


If Range("screenshot").EntireRow.Hidden = True Then
Range("screenshot").EntireRow.Hidden = False

Else
Range("screenshot").EntireRow.Hidden = True

End If

End Sub
 

Attachments

  • Show_Hide_Screenshot.xlsm
    31.2 KB · Views: 9
Hi Matt ,

Right click on the picture , click on Size and Properties , click on the Properties tab , and click on the Option button :

Move and Size with cells

Narayan
 
Thanks for this information but this is for a template that won't have any images to start with... is there a way to select all images in worksheet or range and apply these properties?
 
@Matt F,

Sorry for the late response. Perhaps you could try the following instead. You will, of course, need to reverse this at some point to display them again.

Code:
ActiveWorkbook.DisplayDrawingObjects = xlHide

From the workbook you can toggle this display using the keyboard shortcut CTRL + 6 (at least this works for US keyboard / settings).

Hope that helps.

Regards,
Ken
 
Back
Top