On Error Resume Next Fichier = ActiveWorkbook.Path & "" & "MonImage" & ".jpg" ' On cherche le fichier image Range("A1").Select ActiveSheet.Pictures.Insert(Fichier).Select
Sub RechercheMot() Dim Var As String Dim Fichier As String On Error Resume Next Fichier = ActiveWorkbook.Path & "" & "MonImage" & ".jpg" ' On cherche le fichier image Var = "1ère Femme"'vous pouvez mettre un TextBox If Var = "" Then Exit Sub Set MotTrouvé = Cells.Find(What:=Var) If Not MotTrouvé Is Nothing Then MotTrouvé.Select ActiveCell.Offset(0, 1).Select ActiveSheet.Pictures.Insert(Fichier).Select Else MsgBox "Rien trouvé" Exit Sub End If End Sub
Dim Fichier As String Dim Var As String Private Sub CommandButton1_Click() Fichier = Application.GetOpenFilename( _ "Fichiers Image (*.jpg;*.gif;*.png;*.tif;*.bmp),*.jpg;*.gif;*.png;*.tif;*.bmp") End Sub Private Sub CommandButton2_Click() If TextBox1 = "" Then MsgBox "Entrez un nom!" Exit Sub Else RechercheMot End If End Sub Sub RechercheMot() On Error Resume Next Var = TextBox1 ' ou ComboBox If Var = "" Then Exit Sub Set MotTrouvé = Cells.Find(What:=Var) If Not MotTrouvé Is Nothing Then MotTrouvé.Select ActiveCell.Offset(0, 1).Select ActiveSheet.Pictures.Insert(Fichier).Select Else MsgBox "Rien trouvé" Exit Sub End If End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim img As String Dim Fichier As String Private Sub ComboBox1_Change() On Error Resume Next img = ComboBox1.Value Fichier = ActiveWorkbook.Path & "" & img & ".jpg" FindIt End Sub Private Sub FindIt() Dim oRange As Range Dim vRow As Variant If img = "" Then Exit Sub Feuil1.Activate Set oRange = Feuil1.Range("A:A") 'Find the full cell contents 'vRow = Application.Match(nom, oRange, False) 'Trouver dans une partie du contenu de la cellule vRow = Application.Match("*" & img & "*", oRange, False) If IsError(vRow) Then MsgBox "Non trouvé" Else Feuil1.Range("A" & vRow).Select ActiveCell.Offset(0, 1).Select ActiveSheet.Pictures.Insert(Fichier).Select End If End Sub