1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Private Sub ComboBox1_Click()
Dim Chemin As String, C As Range, ResAdr As String
Chemin = "C:\Users\Daniel\Documents\Donnees\Daniel\mpfe"
Set C = Cells.Find(Me.ComboBox1.Value, , , xlPart)
If Not C Is Nothing Then
Me.ComboBox2.Clear
ResAdr = C.Address
Do
If Left(C.Value, Len(Me.ComboBox1.Value)) = Me.ComboBox1.Value Then Me.ComboBox2.AddItem C.Value
Set C = Cells.FindNext(C)
Loop Until C.Address = ResAdr
If Me.ComboBox2.ListCount > 0 Then
Me.Height = 130
Me.ComboBox2.Visible = True
Else
C.Offset(, 1).Select
Set img = ActiveSheet.Pictures.Insert(Chemin & "\" & Me.ComboBox1.Value & ".jpg")
img.Height = C.Height
End If
End If
Unload Me
End Sub
Private Sub ComboBox2_Click()
Set C = Cells.Find(Me.ComboBox2.Value, , , xlWhole)
C.Offset(, 1).Select
Chemin = "C:\Users\Daniel\Documents\Donnees\Daniel\mpfe"
Set img = ActiveSheet.Pictures.Insert(Chemin & "\" & Me.ComboBox2.Value & ".jpg")
img.Height = C.Height
Unload Me
End Sub |
Partager