+ Reply to Thread
Results 1 to 2 of 2

View image View image Following the selection in dropdown list

  1. #1
    Registered User
    Join Date
    05-28-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    1

    View image View image Following the selection in dropdown list

    Hello,

    Please help me to display an image in a cell depending on the choice in a dropdown list.

    I did several searches but I can not ... (Iím a beginner in VBA)
    The combo is in cell B1 and depending on the choice, I would like the image displayed in the cell C. (ex: fruit 1, fruit 1 image, 2 fruit, fruit Image 2 ...). The images are in a directory on the C: \
    I have two problems with the code attached:
    1. It displays all the images regardless of the choice (I can not write the condition for an image display with a choice ..)
    2. It does not display the code within the specified cell, in this case, the G1.
    Thank you very much for your help!
    Any suggestions would be greatly appreciated!

    here is the code :

    If Target.Address = "$B$1" Then

    With ActiveSheet

    Set pic1 = .Pictures.Insert("C:\fruits\fruit1.jpg")
    With pic1
    .Name = "fruit1"
    .Width = 100
    .Height = 100
    .Top = ActiveSheet.Range("G1").Top
    .Left = ActiveSheet.Range("G1").Left
    End With

    Set pic2 = .Pictures.Insert("C:\fruits\fruit2.jpg")
    With pic2
    .Name = "fruit2"
    .Width = 100
    .Height = 100
    .Top = ActiveSheet.Range("G1").Top
    .Left = ActiveSheet.Range("G1").Left
    End With

    Set pic3 = .Pictures.Insert("C:\fruits\fruit3.jpg")
    With pic3
    .Name = "fruit3"
    .Width = 100
    .Height = 100
    .Top = ActiveSheet.Range("G1").Top
    .Left = ActiveSheet.Range("G1").Left
    End With

    End With

    End If

    End Sub

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Excel 2016
    Posts
    10,179

    Re: View image View image Following the selection in dropdown list

    Hello & Welcome to the Board,

    Please follow the forum rules and use code tags when posting code.

    Take a look at Picture Lookup – 1172 – Dueling Excel for a possible solution.
    HTH
    Regards, Jeff

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1