Select a picture according to a selection on a dropdown box

J

Johanna Gronlund

Hello,

I have made three pictures out of autoshapes on one sheet (this will be
hidden from the user). I would like to have another sheet where one of these
pictures is displayed according to a selection in a dropdown box. So, if the
user selects Group 1, I would like picture 1 to be displayed. If they select
Group 2, I would like picture 2 to be displayed instead and so on. Is this
do-able? I am not very confident with VB but have recorded some macros in the
past.

Thanks a lot for your help in advance.
 
J

Jim Thomlinson

In it's simplest form here is some code that should get you started. It
detects changes in cell A1 and grabs shapes from sheet1 an dpastes them onto
the sheet with the code in it. This code must go inside the sheet. Right
click the sheet tab and select view code. Paste the following...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Select Case Target.Value
Case "Round"
On Error Resume Next
Me.Shapes(1).Delete
On Error GoTo 0
Sheet1.Shapes("Oval 2").Copy 'Shape named oval 2 on sheet1
Me.Paste

Case "Square"
On Error Resume Next
Me.Shapes(1).Delete
On Error GoTo 0
Sheet1.Shapes("Rectangle 1").Copy 'Shape named rectangle 1
Me.Paste
End Select
End If
End Sub
 
G

Gord Dibben

To have a picture show up based on VLOOKUP when you select an item from a DV
list or type in a name see JE MCGimpsey's site.

http://www.mcgimpsey.com/excel/lookuppics.html

As written John's code allows for only one picture to be displayed and the
pictures must be stored on the same worksheet as the VLOOKUP formula.

But that will pose no problem...........simply cut and paste the shapes to
the sheet in which you want them to be displayed.

Or you need multiple pictures shown from VLOOKUPS.............

Got to Debra Dalgeish's site for a sample workbook from Bernie Dietrick for
adding pictures via selections.

Allows for more than one picture to be displayed on a sheet but also
requires the pictures be stored on same sheet.

http://www.contextures.on.ca/excelfiles.html#DataVal

DV0049 - ClipArt Selection


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top