Help w/ show/hide on click function for vba?

jdlev

New Member
Joined
Jan 6, 2017
Messages
27
Hi Guys,

Trying to click on a thumbnail of an image to reveal a full size image in a static position on the worksheet. The row on the left is a thumbnail of the full size picture on the right. What's the best method? Should I use a show/hide property for the larger picture or should the thumbnails be a reduced version of the larger image? By default, I'd want an image shown at all times, so I assume I'd have to have 2 separate images of each picture - one thumbnail and one full size?

So basically, just need to assign a macro to a picture to show and hide a larger version of the same image. Here's an example of what I'm talking about:

 

jdlev

New Member
Joined
Jan 6, 2017
Messages
27
Actually....scratch that...an easier option would just be to move the picture to the front rather than show/hide it. So, how would I go about making a more efficient script.

I basically have the small images on the left named "thumbnail1...5" and the larger images on the right named "fullsize1...5"...how could I shorten the script so I can use the same macro for all 5 buttons?
 

jdlev

New Member
Joined
Jan 6, 2017
Messages
27
Here's what I came up with on my own. It works, but it's by no means elegant...

Sub picToFront1_click()
ActiveSheet.Pictures("fullsize1").Select
Selection.ShapeRange.ZOrder (msoBringToFront)
End Sub


Sub picToFront2_click()
ActiveSheet.Pictures("fullsize2").Select
Selection.ShapeRange.ZOrder (msoBringToFront)
End Sub


Sub picToFront3_click()
ActiveSheet.Pictures("fullsize3").Select
Selection.ShapeRange.ZOrder (msoBringToFront)
End Sub


Sub picToFront4_click()
ActiveSheet.Pictures("fullsize4").Select
Selection.ShapeRange.ZOrder (msoBringToFront)
End Sub


Sub picToFront5_click()
ActiveSheet.Pictures("fullsize5").Select
Selection.ShapeRange.ZOrder (msoBringToFront)
End Sub
 

Forum statistics

Threads
1,085,872
Messages
5,386,485
Members
401,999
Latest member
CROSBIE3103

Some videos you may like

This Week's Hot Topics

Top