+ Reply to Thread
Results 1 to 18 of 18

Pictures in drop down over a range.

  1. #1
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Pictures in drop down over a range.

    Hi....once again I'm stuck and need some of your expert help!!!

    I have several pictures on one worksheet labelled pict_1 to pict_x, and would like these pictures to be the source of a drop down in a range of cells in another sheet .. e.g. a1-a10.
    Once a picture is selected then the picture is displayed in that particular cell, and each cell in the range can be any of the pictures or blank.

    I have searched high and low but can't get exactly what I'm after, so hope you can help!

    Thanks for looking.

  2. #2
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Anyone have any ideas?

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Pictures in drop down over a range.

    Perhaps uploading a workbook that outlines the before and after of what it is you are trying to do would be beneficial to you and us.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Please find attached sample...really hope you can help!
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Really appreciate some help chaps!

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Pictures in drop down over a range.

    Are you asking for the formatting of the validationlist (showing pictures instead of picturename) or are asking for code to put the chosen picture in a certain cell ?



  7. #7
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Thank you for your reply.

    Ideally, I am looking for a way for any of the cells colored yellow to show any of the pictures by means of a combo box / dropdown box with variables pict_1 to pict_x. These are the names of the pictures on sheet 2. Once a selection has been made, that particular cell changes to the particular picture. Each picture can be shown for each or any cell. Hope this is clear and once again many thanks!

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Pictures in drop down over a range.

    I have a technique that does this but I can't access it until later
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Pictures in drop down over a range.

    You cannot add anything to the actual cell that has the data validation. What is the purpose of this?

  10. #10
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Sorry if there is any confusion here. I will try to make it as straightforward as I can!!!!

    I simply need a range of cells to show text in the form of a drop down / combo box, that relates to some pictures....e.g. Picture_Car,Picture_House,Picture_tree etc.

    For each cell in a range (I have coloured them yellow in my previous attachment), I wish the user to 'pick' the picture from that selection, and then for that cell (or if this is impossible the cell to the direct right) to change to the relevant picture of that name. Note: These pictures are positioned in the another sheet (say Sheet 2).

    Each cell in the range can have any picture once or indeed zero times or any number of times.

    I really hope that this is clear and that you can help.

    Once again many thanks for looking!

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Pictures in drop down over a range.

    The images are not the same size as the cells so would need re-sizing.

    As I said earlier I can use the selection to display the selected image, but the range it occupies needs to be at least the same size as the image

  12. #12
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Hi Roy,

    The actual pictures that I will use (for an existing company product line(NOT the ones in my demo file)) are quite small (smaller than the cell), and I an easily make them the same size.

    I simply can't see a way of displaying these images over a range of cells....so please suggest suitable methods.
    Thanks again!

  13. #13
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Pictures in drop down over a range.

    cfr. the attachment

    PS I do not understand what you mean by 'over a range'.
    Attached Files Attached Files
    Last edited by snb; 10-11-2011 at 11:44 AM.

  14. #14
    Registered User
    Join Date
    09-18-2009
    Location
    Grand Forks, North Dakota
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: Pictures in drop down over a range.

    Hey SNB I tried your workbook in excel 2010 and an error was thrown runtime error 449 Argument not optional...

    Looks like the problem code line is highlighted below

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 1 And Target <> "" Then
    c01 = ThisWorkbook.Path & "\" & Target.Value & ".gif"
    If Dir(c01) = "" Then
    With Sheets("sheet2").Shapes(Target.Value)
    .CopyPicture
    With .Parent.ChartObjects.Add(, , .Width, .Height).Chart
    .Paste
    .Export c01, "GIF"
    .Parent.Delete
    End With
    End With
    End If
    On Error Resume Next
    Target.AddComment
    Target.Comment.Shape.Fill.UserPicture c01
    Target.Comment.Visible = True
    End If
    End Sub


    I also would be interested in doing something like this but could I just send the image to a text box maybe or a slide show? A slide show would be ideal...say I clicked a button and images from another sheet were implemented in a slide show.
    Last edited by ndjustin20; 10-11-2011 at 11:16 AM.

  15. #15
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Pictures in drop down over a range.

    Just change into:

    Please Login or Register  to view this content.


    I uploaded an amended attachment in the previous post.
    Last edited by snb; 10-11-2011 at 11:45 AM.

  16. #16
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Pictures in drop down over a range.

    Thanks for the reply, I can't get the file to work, and so have attached another demo, which I think explains my problem further.

    P.S The range i am refered to simply means that I would like the process of picture selection to work over more than one cell.

    Once again thanks for your patience,
    Attached Files Attached Files
    Last edited by skyping; 10-11-2011 at 11:50 AM.

  17. #17
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Pictures in drop down over a range.

    I replaced the attachment.

  18. #18
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Pictures in drop down over a range.

    This doesn't use VBA, but needs the images re-sizing. I've used the smaller horse picture from the last example. Select Picture 4 from the list in A1

    This is all done with named ranges & pictures
    Attached Files Attached Files

+ 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