Closed Thread
Results 1 to 11 of 11

Picture when combo box is changed

Hybrid View

  1. #1
    bugmenot
    Guest

    Exclamation Picture when combo box is changed

    Hey guys,

    This is the first VBA project i've done on Excel, and its not very big. I've never done any programming before, but i need help on this

    What i'm trying to do it to have the Combo box that when an item is selected the respective picture shows next to it (i've got a seperate sheet with the products, prices, pics etc...)

    After trying everything to get the picture to show, i switched to VBA because it looked like i could do it in that. The first thing i did was record a macro for each picture - the first one goes like this (its called TEST)

    Sub TEST()
    '
    ' TEST Macro
    '
    
    '
        Range("M4").Select
        Sheets("Products").Select
        Selection.Copy
        Sheets("Quotes").Select
        Range("M4").Select
        ActiveSheet.Paste
        Range("N4").Select
    End Sub
    The first problem i had was with Sheets("Quotes").Select - for some reason it didn't like it and gave me an error. After some googling I solved it.

    Now the problem i've got is with the Worksheet Change (is this the right thing to use?)

    This is what i've got -
    Private Sub Worksheet_Change(ByVal Target As Range)
    If L4 = 1 (1 is the value that comes from the combo box) Then
            TEST
        End If
    End Sub
    Correct me if i'm wrong, but this should run every time something is changed on the sheets?
    Nothing happens when I select the first value in my combo box.

    Any help would be great

    Thanks =)
    Last edited by bugmenot; 06-28-2009 at 03:26 AM.

  2. #2
    batesie
    Guest

    Re: Picture when combo box is changed

    Ok it is uploaded here - http://www.2shared.com/file/6481238/...CT_IDEA-6.html

    Donkey its the one with assign macro...

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Picture when combo box is changed

    Sorry, I'm confused - 2 different members ?

    Also please upload files here directly.

  4. #4
    batesie
    Guest

    Re: Picture when combo box is changed

    Quote Originally Posted by DonkeyOte View Post
    Sorry, I'm confused - 2 different members ?

    Also please upload files here directly.
    Yeah sorry, was my mates account...

    Ok, i think i've managed to attach it now
    Attached Files Attached Files

  5. #5
    batesie
    Guest

    Re: Picture when combo box is changed

    any help...?

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

    Re: Picture when combo box is changed

    Take a look at the example database form here

    http://www.excel-it.com/vba_examples.htm
    Hope that helps.

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

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    01-06-2005
    Location
    India
    Posts
    10

    Re: Picture when combo box is changed

    You may like to check this link

    http://www.jkp-ads.com/articles/ShowPicture00.asp
    Swastik

  8. #8
    batesie
    Guest

    Re: Picture when combo box is changed

    Thanks guys, i've seen the jkp-ads one before, but never been able to make it work... would anybody who knows what its about mind having a look at my sheets and change it so that it works...?

  9. #9
    Forum Contributor
    Join Date
    04-01-2009
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2010
    Posts
    280

    Re: Picture when combo box is changed

    Is this what you wanted?

    No code, just copied a cell and Pasted as Picture Link (off the Paste Menu).
    Changed the name of the Picture Link to your named range (PictureList).
    And fixed your offset to only pull one cell/picture (no height or width).
    Attached Files Attached Files

  10. #10
    batesie
    Guest

    Re: Picture when combo box is changed

    Yes thankyou, that is exactly what I need =)

    Can i ask exactly how you did that?

    Oh and is there any way to make more than one, as i will need about 10 and the pictures will be in the same colum... :S

    Thanks

    __________________________________EDIT_________________________________-

    Never mind, after experimenting with the name manager I managed to do it

    Thank you very much Chance =)
    Last edited by batesie; 06-30-2009 at 04:35 AM.

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Picture when combo box is changed

    When you say ComboBox - are you using Forms Control or Active X Control - if in design mode you right click on the ComoBox do you see option to "Assign Macro" or not ?

    It would be helpful if you could post a sample file.

Closed 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