Hulk
XLDnaute Barbatruc
Hello,
Je voudrais savoir pourquoi ces codes ne fonctionnent pas ?
Ou
Au fait, je souhaiterais qu'il copie la ligne puis la colle dans la dernière ligne vide (ou au moins ewn A1) de la feuille 2.
Pourtant en sélectionnant d'abord une cellule de la colonne A de la feuille 2, ce code fonctionne...
Incompréhensible pour moi 😕
Je voudrais savoir pourquoi ces codes ne fonctionnent pas ?
Code:
Private Sub BtnRecherche_Click()
Dim x As Range
Dim Mot
On Error Resume Next
Mot = InputBox("Quel mot recherchez-vous ?", "")
If Mot = "" Then Exit Sub
For Each x In Sheets("Feuil1").Range("A2:A" & Range("A65536").End(xlUp).Row)
If x = Mot Then
x.EntireRow.Copy
Sheets("Feuil2").Select
Range("A1").Select
ActiveSheet.Paste
End If
Next x
End Sub
Code:
Private Sub BtnRecherche_Click()
Dim x As Range
Dim Mot
On Error Resume Next
Mot = InputBox("Quel mot recherchez-vous ?", "")
If Mot = "" Then Exit Sub
For Each x In Sheets("Feuil1").Range("A2:A" & Range("A65536").End(xlUp).Row)
If x = Mot Then
x.EntireRow.Copy
Sheets("Feuil2").Select
Range("A1:A" & Range("A65536").End(xlUp).Row).Select
ActiveSheet.Paste
End If
Next x
End Sub
Pourtant en sélectionnant d'abord une cellule de la colonne A de la feuille 2, ce code fonctionne...
Code:
Private Sub BtnRecherche_Click()
Dim x As Range
Dim Mot
On Error Resume Next
Mot = InputBox("Quel mot recherchez-vous ?", "")
If Mot = "" Then Exit Sub
For Each x In Sheets("Feuil1").Range("A2:A" & Range("A65536").End(xlUp).Row)
If x = Mot Then
x.EntireRow.Copy
Sheets("Feuil2").Select
ActiveSheet.Paste
End If
Next x
End Sub