ms06f
01-18-2012, 08:36 PM
I try to modified (Listbox-Show Picture on Click-Select Data on Double-Click excel vba file) .
I add myname2 , myname3 range at column I & J
In userform add image2 and image3
list_box_picture.xls vba how to modifity?
Help me please....
Private Sub listBox1_Click()
Dim EmpFound As Range
Dim EmpFound2 As Range
Dim fPath As String
With Range("myName")
Set EmpFound = .Find(ListBox1.Value)
On Error Resume Next
If EmpFound Is Nothing Then
Image1.Picture = LoadPicture(fPath & "nopic.gif")
Else
With EmpFound
fPath = ThisWorkbook.Path & "\"
On Error Resume Next
Image1.Picture = LoadPicture(fPath & "\" & ListBox1.Value & ".jpg")
If Err = 0 Then Exit Sub
Image1.Picture = LoadPicture(fPath & "nopic.gif")
End With
End If
End With
Set EmpFound = Nothing
With Range("myName2")
Set EmpFound2 = .Find(ListBox1.Value)
On Error Resume Next
If EmpFound Is Nothing Then
Image2.Picture = LoadPicture(fPath & "nopic.gif")
Else
With EmpFound2
fPath = ThisWorkbook.Path & "\"
On Error Resume Next
Image2.Picture = LoadPicture(fPath & "\" & ListBox1.Value & ".jpg")
If Err = 0 Then Exit Sub
Image2.Picture = LoadPicture(fPath & "nopic.gif")
End With
End If
End With
Set EmpFound = Nothing
End Sub
I add myname2 , myname3 range at column I & J
In userform add image2 and image3
list_box_picture.xls vba how to modifity?
Help me please....
Private Sub listBox1_Click()
Dim EmpFound As Range
Dim EmpFound2 As Range
Dim fPath As String
With Range("myName")
Set EmpFound = .Find(ListBox1.Value)
On Error Resume Next
If EmpFound Is Nothing Then
Image1.Picture = LoadPicture(fPath & "nopic.gif")
Else
With EmpFound
fPath = ThisWorkbook.Path & "\"
On Error Resume Next
Image1.Picture = LoadPicture(fPath & "\" & ListBox1.Value & ".jpg")
If Err = 0 Then Exit Sub
Image1.Picture = LoadPicture(fPath & "nopic.gif")
End With
End If
End With
Set EmpFound = Nothing
With Range("myName2")
Set EmpFound2 = .Find(ListBox1.Value)
On Error Resume Next
If EmpFound Is Nothing Then
Image2.Picture = LoadPicture(fPath & "nopic.gif")
Else
With EmpFound2
fPath = ThisWorkbook.Path & "\"
On Error Resume Next
Image2.Picture = LoadPicture(fPath & "\" & ListBox1.Value & ".jpg")
If Err = 0 Then Exit Sub
Image2.Picture = LoadPicture(fPath & "nopic.gif")
End With
End If
End With
Set EmpFound = Nothing
End Sub