View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
vane0326[_2_] vane0326[_2_] is offline
external usenet poster
 
Posts: 1
Default Image changed based on vlookup function


Ok that could be done. First of all select cell A1 and go to the top
menu that says
*Data* then
*Validation* then you would see 3 tabs go to
*Settings* then in the allow box look for
*List* then select your range on your worksheet that has the names of
your pictures and hit
OK

Second:

Go to the top menu and right click on
*Insert* then look for the word
*Control Box* select it. Then you'll see option buttons look for the
*Image Control* button and select it. Then select D1 the image control
box will appear. Then make sure to hit the Exit Design mode. If you
dont know whats a Exit Design mode take a look at the link below.

http://www.contextures.com/xlDataVal11.html

Third now right click on your worksheet tab and select
*View Code* then paste this code you see below




Code:
--------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strPath As String

If Intersect(Target, Range("$A$1")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
ffname = PicPath & tbxpartnr & ".jpg"
strPath = "C:\MyPicture\" 'Choose your file path
On Error Resume Next
Image1.Picture = LoadPicture(strPath & Target.Text & ".jpg")
If Err = "53" Then
MsgBox "Picture Does Not Exist : "


End If
End Sub
--------------------


--
vane0326
------------------------------------------------------------------------
vane0326's Profile: http://www.excelforum.com/member.php...o&userid=14731
View this thread: http://www.excelforum.com/showthread...hreadid=521397