Sub jul()
Dim ws As Worksheet
Dim c As Range
reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _
"(minuscules ou majuscules...)", "Lancer une recherche...")
If reC = "" Then Exit Sub
For Each ws In Worksheets
With ws.Cells
Set c = .Find(reC)
If Not c Is Nothing Then
adDt = c.Address
With Application
.GoTo Reference:=ws.Range(adDt), Scroll:=True
.ScreenUpdating = True
End With
nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _
& "sur les autres onglets ?" & Chr(10), 36, _
"Recherche accomplie...")
If nreC = vbNo Then Exit Sub
Set c = .FindNext(c)
Do
Set c = .FindNext(c)
Loop While c.Address <> adDt
End If
End With
Next ws
rnreC = MsgBox("Aucune autre donnée correspondante à : " _
& UCase(reC), vbInformation, "Lancer une recherche...")
End Sub
Quel type de formule dois-je utiliser pour ,par exemple, effacer ou copier
la ligne ou se trouve la cellule recherchée et trouvée par la macro
recherche??
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
PMO
Bonjour,
Essayez avec le code suivant
'********** Sub jul() Dim ws As Worksheet Dim c As Range Dim reponse% reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _ "(minuscules ou majuscules...)", "Lancer une recherche...") If reC = "" Then Exit Sub For Each ws In Worksheets With ws.Cells Set c = .Find(reC) If Not c Is Nothing Then adDt = c.Address With Application .GoTo Reference:=ws.Range(adDt), Scroll:=True .ScreenUpdating = True End With reponse% = MsgBox("Voulez-vous effacer cette ligne ?", _ vbYesNo + vbDefaultButton2) If reponse% = vbYes Then Rows(c.Row).ClearContents End If nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _ & "sur les autres onglets ?" & Chr(10), 36, _ "Recherche accomplie...") If nreC = vbNo Then Exit Sub End If Set c = .Find(reC) If Not c Is Nothing Then Do Set c = .FindNext(c) Loop While c.Address <> adDt End If End With Next ws rnreC = MsgBox("Aucune autre donnée correspondante à : " _ & UCase(reC), vbInformation, "Lancer une recherche...") End Sub '**********
Cordialement. -- PMO Patrick Morange
Voici une macro de recherche
Sub jul() Dim ws As Worksheet Dim c As Range reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _ "(minuscules ou majuscules...)", "Lancer une recherche...") If reC = "" Then Exit Sub For Each ws In Worksheets With ws.Cells Set c = .Find(reC) If Not c Is Nothing Then adDt = c.Address With Application .GoTo Reference:=ws.Range(adDt), Scroll:=True .ScreenUpdating = True End With nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _ & "sur les autres onglets ?" & Chr(10), 36, _ "Recherche accomplie...") If nreC = vbNo Then Exit Sub Set c = .FindNext(c) Do Set c = .FindNext(c) Loop While c.Address <> adDt End If End With Next ws rnreC = MsgBox("Aucune autre donnée correspondante à : " _ & UCase(reC), vbInformation, "Lancer une recherche...") End Sub
Quel type de formule dois-je utiliser pour ,par exemple, effacer ou copier la ligne ou se trouve la cellule recherchée et trouvée par la macro recherche??
Merci
Bonjour,
Essayez avec le code suivant
'**********
Sub jul()
Dim ws As Worksheet
Dim c As Range
Dim reponse%
reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _
"(minuscules ou majuscules...)", "Lancer une recherche...")
If reC = "" Then Exit Sub
For Each ws In Worksheets
With ws.Cells
Set c = .Find(reC)
If Not c Is Nothing Then
adDt = c.Address
With Application
.GoTo Reference:=ws.Range(adDt), Scroll:=True
.ScreenUpdating = True
End With
reponse% = MsgBox("Voulez-vous effacer cette ligne ?", _
vbYesNo + vbDefaultButton2)
If reponse% = vbYes Then
Rows(c.Row).ClearContents
End If
nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _
& "sur les autres onglets ?" & Chr(10), 36, _
"Recherche accomplie...")
If nreC = vbNo Then Exit Sub
End If
Set c = .Find(reC)
If Not c Is Nothing Then
Do
Set c = .FindNext(c)
Loop While c.Address <> adDt
End If
End With
Next ws
rnreC = MsgBox("Aucune autre donnée correspondante à : " _
& UCase(reC), vbInformation, "Lancer une recherche...")
End Sub
'**********
Cordialement.
--
PMO
Patrick Morange
Voici une macro de recherche
Sub jul()
Dim ws As Worksheet
Dim c As Range
reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _
"(minuscules ou majuscules...)", "Lancer une recherche...")
If reC = "" Then Exit Sub
For Each ws In Worksheets
With ws.Cells
Set c = .Find(reC)
If Not c Is Nothing Then
adDt = c.Address
With Application
.GoTo Reference:=ws.Range(adDt), Scroll:=True
.ScreenUpdating = True
End With
nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _
& "sur les autres onglets ?" & Chr(10), 36, _
"Recherche accomplie...")
If nreC = vbNo Then Exit Sub
Set c = .FindNext(c)
Do
Set c = .FindNext(c)
Loop While c.Address <> adDt
End If
End With
Next ws
rnreC = MsgBox("Aucune autre donnée correspondante à : " _
& UCase(reC), vbInformation, "Lancer une recherche...")
End Sub
Quel type de formule dois-je utiliser pour ,par exemple, effacer ou copier
la ligne ou se trouve la cellule recherchée et trouvée par la macro
recherche??
'********** Sub jul() Dim ws As Worksheet Dim c As Range Dim reponse% reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _ "(minuscules ou majuscules...)", "Lancer une recherche...") If reC = "" Then Exit Sub For Each ws In Worksheets With ws.Cells Set c = .Find(reC) If Not c Is Nothing Then adDt = c.Address With Application .GoTo Reference:=ws.Range(adDt), Scroll:=True .ScreenUpdating = True End With reponse% = MsgBox("Voulez-vous effacer cette ligne ?", _ vbYesNo + vbDefaultButton2) If reponse% = vbYes Then Rows(c.Row).ClearContents End If nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _ & "sur les autres onglets ?" & Chr(10), 36, _ "Recherche accomplie...") If nreC = vbNo Then Exit Sub End If Set c = .Find(reC) If Not c Is Nothing Then Do Set c = .FindNext(c) Loop While c.Address <> adDt End If End With Next ws rnreC = MsgBox("Aucune autre donnée correspondante à : " _ & UCase(reC), vbInformation, "Lancer une recherche...") End Sub '**********
Cordialement. -- PMO Patrick Morange
Voici une macro de recherche
Sub jul() Dim ws As Worksheet Dim c As Range reC = InputBox(Chr(10) & "Rechercher :" & Chr(10) & _ "(minuscules ou majuscules...)", "Lancer une recherche...") If reC = "" Then Exit Sub For Each ws In Worksheets With ws.Cells Set c = .Find(reC) If Not c Is Nothing Then adDt = c.Address With Application .GoTo Reference:=ws.Range(adDt), Scroll:=True .ScreenUpdating = True End With nreC = MsgBox("Désirez-vous poursuivre la recherche" & Chr(10) _ & "sur les autres onglets ?" & Chr(10), 36, _ "Recherche accomplie...") If nreC = vbNo Then Exit Sub Set c = .FindNext(c) Do Set c = .FindNext(c) Loop While c.Address <> adDt End If End With Next ws rnreC = MsgBox("Aucune autre donnée correspondante à : " _ & UCase(reC), vbInformation, "Lancer une recherche...") End Sub
Quel type de formule dois-je utiliser pour ,par exemple, effacer ou copier la ligne ou se trouve la cellule recherchée et trouvée par la macro recherche??