+ Reply to Thread
Results 1 to 4 of 4

Thread: How to show several picures in Excel based on different cell value

  1. #1
    Registered User
    Join Date
    04-05-2010
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2003
    Posts
    2

    How to show several picures in Excel based on different cell value

    Hi!

    If I want to show several pictures/images in Excel, were every picture/image is based on different cell (one macro for each picture), how will the VBE code be?

    Example; If I have a list of several job positions and a list of several people to fill into these positions, and when I chose Person 1 in position 1, a picture of person one should show, when I chose Person 2 in position 2, a picture of person two should show, etc.. So then the sheet would show all the people in the different positions... Is this possible to do?


    Hope someone could help me on this..
    PS; I am not a programmer so you most likely have to explain it to me on a basic level..

    Thanks!!

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: How to show several picures in Excel based on different cell value

    Hi,

    Take a look at Jim's very nice solution ...
    http://www.mcgimpsey.com/excel/lookuppics.html

    HTH

  3. #3
    Registered User
    Join Date
    04-05-2010
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: How to show several picures in Excel based on different cell value

    Quote Originally Posted by JeanRage View Post
    Hi,

    Take a look at Jim's very nice solution ...
    http://www.mcgimpsey.com/excel/lookuppics.html

    HTH

    Hi Jean,

    Thanks for the answer!
    I have actually tried this soultion, but it only works with one picture "at the time"... I tried to copy several of this this macro into the same VBE, but how do I manage make each macro work on one particular cell..? I got an error message which sound like; "Ambiguous name detected: Worksheet_Calculate"... How can I separate these macro so it can dispaly several pictures "at the same time"..?

  4. #4
    Valued Forum Contributor MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    888

    Re: How to show several picures in Excel based on different cell value

    Hi, Try this:-
    Example:- Place some names in column "A". In column "B" next to the names place the pictures, (Make sure the top left corner of the picture is in the Column "B" cell).
    Right click your sheet Tab , Select "View Code" , VB Window appears.
    Paste the code below into the VB Window.
    Close the VB Window..
    To Hide the Picture, Click on the Name in Column "A" next to the Picture.
    To show the Picture click the Named Cell again.
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim Pic As Shape
    For Each Pic In ActiveSheet.Shapes
        If Pic.Type = msoPicture Then
         If Target.Offset(, 1).Address = Pic.TopLeftCell.Address Then
           If Pic.Visible = True Then
                Pic.Visible = False
           Else
                Pic.Visible = True
           End If
        End If
    End If
    Next Pic
    End Sub
    Regards Mick

+ 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.2.0