MrExcel Publishing
Your One Stop for Excel Tips & Solutions

makeing a picture appear and disappear


Posted by steve on April 12, 2001 7:00 AM

How can I make a picture appear by simply clicking on a cell. Lets say picture 1 appear when cell a1 was selected, 2 when B1, 3 when c1 and so on. I also need a way to close and enlarge it(maybe with a userform?).
Not sure how I should go about doing this, should I stack all pictures on top of each other and make them not visible or is there a way to have them on another page.
Any help would be greatly appreciated

thanks steve


Posted by lenze on April 12, 2001 8:48 AM

I'm not sure how to do this by clicking on a cell, but you could use hyperlinks to display the pictures stored on another sheet or even another file. You can use text for the hyperlink or an object such as a command button. You can have a hyperlink for each picture, or if you use a command button, you could write code to link to a specific picture based on the value in a designated cell.

Posted by Ivan Moala on April 12, 2001 4:36 PM

Steve
Just a quick exampple of how you could do this
via the sheets events (selection Change)
This code goes into the sheets module and
assumes 3 pictures.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Select Case Target.Address

Case "$A$1"
ActiveSheet.Shapes("picture 1").Visible = True
ActiveSheet.Shapes("picture 2").Visible = False
ActiveSheet.Shapes("picture 3").Visible = False
Case "$A$2"
ActiveSheet.Shapes("picture 1").Visible = False
ActiveSheet.Shapes("picture 2").Visible = True
ActiveSheet.Shapes("picture 3").Visible = False
Case "$A$3"
ActiveSheet.Shapes("picture 1").Visible = False
ActiveSheet.Shapes("picture 2").Visible = False
ActiveSheet.Shapes("picture 3").Visible = True
Case Else
ActiveSheet.Shapes("picture 1").Visible = False
ActiveSheet.Shapes("picture 2").Visible = False
ActiveSheet.Shapes("picture 3").Visible = False

End Select

End Sub

Ivan

Posted by steve on April 12, 2001 4:55 PM

Any ideas on how to bring a picture from another page. I'm going to have as many as 30 pictures I want to show them in the range you see visible on the screen and only ever one at a time.