how to have a pictue appear when option selected in combo bo

aamershaikh

New Member
Joined
Apr 30, 2006
Messages
1
hey des any one no how to create some sort of macro where when i choose an option in a combo the corresponding picture for it, appear next to the combo bo.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,813
Office Version
  1. 365
Platform
  1. Windows
Hi, and welcome to Mr. Excel!!

I've not got much time, and I won't be available for a few days for any more help, but this should start you off, then you can adapt it for your own needs.

I've started a new workbook.
On sheet1 I've made a simple list: the word apple in A1, and orange in A2.

I've downloaded a picture of an apple to the c drive, and called it apple.jpg
I've downloaded a picture of an orange to the c drive, and called it orange.jpg (not very inspiring is it!!)
I've created a combobox (from the controlbox toolbar) called combobox1, on sheet1.
I've created an image (from the controlbox toolbar) on sheet1 called image1, and positioned it where I want relative to the combobox. Size it at this stage if you wish, as well.
In the properties section of the combobox, I've set the list fill range to A1:A2.

In design mode on sheet1, I've right-clicked the combobox, and selected "view code".
The code needs to read thus (copy and paste if you like):
Code:
Private Sub ComboBox1_Change()
If Me.ComboBox1.Value = "apple" Then
Me.Image1.Picture = LoadPicture("C:\apple.jpg")
Else
Me.Image1.Picture = LoadPicture("C:\orange.jpg")
End If
End Sub
Now, when you select a fruit from the combobox, the appropriate picture should populate image1.
 

Forum statistics

Threads
1,136,512
Messages
5,676,289
Members
419,618
Latest member
Grisego

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top