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 32 33 34 35 36 37 38 39 40 41 42
| Private Sub ComboBox1_Click()
Dim Chemin As String, C As Range, ResAdr As String
Chemin = "C:\Users\Daniel\Documents\Donnees\Daniel\mpfe"
Me.ComboBox2.Clear
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 > 1 Then
Me.Height = 130
Me.ComboBox2.Visible = True
Exit Sub
Else
Me.ComboBox2.Clear
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
Private Sub UserForm_Activate()
Set v = Me.ComboBox1
Me.ComboBox2.Visible = False
Me.Height = 70
Me.ComboBox1.Clear
Me.ComboBox1.List = Array("20", "30", "40")
End Sub |
Partager