select picture with list

K

kalpesh

Hello

in sheet

contain customer name & i create a list of customer nam

a1 cell contain lis

now

i select name of customer in list, photo of customer is shwon in b1 cel

please vba help or macro for this
 
D

Don Guillett

This can be done. Here there is a dropdown in a1 tied to this macro in
you SHEET module.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Dim Shp As Shape
On Error GoTo PictureNotFound
Worksheets("Sheet1").Shapes(Me.Range("A1").Value).Copy
'Worksheets("Sheet1").Shapes("don1").Copy

'Delete the previous picture
For Each Shp In Me.Shapes
If Shp.Type = msoPicture Then
If Shp.TopLeftCell.Address = "$C$1" Then
If Shp.Name <> Range("A1").Value Then Shp.Delete
End If
End If
Next
Worksheets("Sheet2").Paste
With Selection
.Name = Range("A1").Value
.Top = Range("C1").Top
.Left = Range("C1").Left
End With
Range("A1").Select
Exit Sub
PictureNotFound: MsgBox "Picture not found!" & vbNewLine _
& "Check Name."
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top