Re : Faire suivre des boutons et USF
Re
un petit mot pour montrer mon avancement sur se que je but Je souhaiterais inclure le texte que voici enfin l'adapter et garder toutes les capacitées de ce code qui était a l'origine d'une InputBox j'aimerais qu'un spécialiste du VBA de ce site et vue tout les messages il y en a d'excellent.
Puisse ètre adapté pour un UserForm. Merci.
Je joint le fichier avec UserForm2
Private Sub CommandButton2_Click()
Dim i As Byte, j As Byte, X As Byte
Dim Cible As String
Dim Val As Object
Dim FirstAddress As String, Resultat As String, Tableau() As String
Cible = InputBox("SAISIR LE NOM DU CAVALIER : ", "Recherche", "Le nom")
Application.ScreenUpdating = False
For i = 2 To Sheets.Count
Sheets(i).Activate
With Sheets(i).UsedRange.Cells
Set Val = .Find(Cible, LookIn:=xlValues)
If Not Val Is Nothing Then
FirstAddress = Val.Address
Do
Val.Select
X = X + 1
ReDim Preserve Tableau(2, X)
Tableau(0, X - 1) = "Cellule " & Val.Address
Tableau(1, X - 1) = Sheets(i).Name
Set Val = .FindNext(After:=ActiveCell)
Loop While Not Val Is Nothing And Val.Address <> FirstAddress
End If
End With
Next i
Sheets(1).Activate
Application.ScreenUpdating = True
Resultat = "Resultat de la recherche sur le mom : " & Cible & Chr(10) & Chr(10)
If X = 0 Then
Resultat = Resultat & "Vide"
Else
For j = 1 To X
Resultat = Resultat & Tableau(0, j - 1) & Chr(9) & Tableau(1, j - 1) & Chr(10)
Next j
End If
MsgBox Resultat
End Sub
Merci encore. Car j'ai beau essayer et je n'arrive a rien.
JPS