MACRO to insert image with respect to drop-down list

Good Morning folks,

I have a doubt that I do not know if it is light or not:

I have a field (the large rectangle) from which I want to insert an image inside it, as per the selected drop-down list.

For example: when I select from the drop-down list (L11) "Ceu2", I want the image of the "Ceu2" located in Q6 to appear in the rectangle. When selecting Ceu, the same thing though for the image in Q5.

However, in the same rectangle, when the person Select through cell L3 the 2nd Drop-Down list, with the options, stop appearing the images of the sky and appear which one he chooses, be it the "oculos" or the"train".

Only by then would be great. I was trying to do this using the index and correspond functions, but it did not reach the character limit of the correspond function kkk

If anyone can lend a hand there.. after I want that past X time without a new drop-down option swap, the image that would appear in the rectangle was that of the" theme " contained in Q9

If I get confused I'll explain again, but at first it was just that. Thank you to anyone who can help=)

insert the description of the image here

 1
Author: Danilo Alves, 2018-11-23

2 answers

Solution without macro

insert the description of the image here

Within what you have already built what you need to do is create a [defined name] with formula and then link with the camera. Follow the steps:

insert the description of the image here

  1. Enter [Name Manager]
  2. In Name Manager create a new item
  3. Steps:
NAME> cImage
Scope> Workbook
Comment> [branco]
refers to: > =OFFSET($Q$4;MATCH($L$11;$P:$P;0)-1;0)
Botão {OK}

Adc. a camera component, to enable:

  1. File > Options
  2. follow Steps 1 to 5. Option 6 should open for you.

insert the description of the image here

From here just select the cell that is the image. In your case a Q Q 5 5. and click on the camera. Note that the image will respect the size of the range / cell. Soon try to add. images of the size you want to use and resize the cell and image of the same size.

insert the description of the image here

Now when selecting the camera that is nothing more than a dotted square, change in the formula indent by =cImage

 2
Author: Hudson Komuro, 2020-06-11 14:45:34

You can use the cbxListaSuspensa_change event so that, each new change in your list a macro is excused and from this execution the image is changed to the path of the image that is contained in the drop-down list.

Sub cbxListaSuspensa_change()
Dim caminho As String
'Valor que está na lista suspensa
caminho = cbxListaSuspensa.Value
'Setar a imagem que deve ser colocada no espaço
sheet1.Image1.Picture = LoadPicture(caminho)
End Sub

Scenario created for the code

 0
Author: Vinicio Schmidt, 2018-11-23 11:40:34