Pictures in xl

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:50 PM GMT

QuestionEdit

Hi.

I'm working on a tool that makes it possible to select a item number by making several selections. As the selections are made I would like to have a picture that is updated depending on the selections.

So. How to make a picture change depending on a value in a cell?

Example. Cell value 1 => picture 1 Cell value 2 => picture 2 and so on.

BR Gert

AnswerEdit

Hi Gert How are you?

If you are familiar with Macros (VBA for Excel), please do the following:

1. Run the VBA editor ( Tools - Macros - Macro - Visual Basic editor) 2. Insert the second userformm and place a picture on it 3. Insert the second userformm and place a picture on it 4. Insert a module and copy the code:

Sub pictures()

Dim R As Range Set R = ActiveSheet.Range("A4:A5") If R.Cells(1, 1) = 1 Then

 UserForm1.Show
 Else
 If R.Cells(2, 1) = 2 Then
  UserForm2.Show

End If End If

End Sub

5. Place a button on the activesheet and assign it to the macro pictures 6. Press the button


Hope this helps Adelaide

Advertisement

©2024 eLuminary LLC. All rights reserved.