OVH Cloud OVH Cloud

Commencer par le bas...

1 réponse
Avatar
claudy
Bonsoir à tous....
j'ai trouvé ceci-dessous qui marche tres bien..
merci à Stéphane Royer, mpfe.
Mais cette merveilleuse macro commence en haut de feuille!
Comment l'appliquer en commençant par les lignes les plus récentes...
c'est à dire en commencant par la Range("a64000").End(xlUp)(2).Select

Sub WorkbookFind()
'Stéphane Royer, mpfe
What = InputBox("Rechercher :")
'If What = "" Then Exit Sub
' For Each sht In Worksheets
'sht.Activate
Set Found = Cells.Find(What)
If Not Found Is Nothing Then
FirstAddress = Found.Address
Do
Found.Activate
Response = MsgBox("Continuer ?", vbYesNo + vbQuestion)
If Response = vbNo Then Exit Sub
Set Found = Cells.FindNext(After:=ActiveCell)
If Found.Address = FirstAddress Then Exit Do
Loop
End If
'Next sht
MsgBox "Recherche terminée !"
End Sub

A+
Merci
--
\\\ ////
( O O )
------oOOo-(_)-oOOo-----------------
Claudy

--------------Oooo------------------
oooO ( )
( ) ) /
\ ( (_/
\_)

1 réponse

Avatar
docm
Bonjour claudy.

Voici, sous toutes réserves, une macro:

Sub FindApartirDuBas()

What = InputBox("Rechercher :")

For I = Range("a65536").End(xlUp).Row To 1 Step -1

StrR = I & ":" & I

Set ligne = Rows(StrR)

Set found = ligne.Find(What)

If Not found Is Nothing Then
FirstAddress = found.Address
Do
found.Activate
Response = MsgBox("Continuer ?", vbYesNo + vbQuestion)
If Response = vbNo Then Exit Sub
Set found = ligne.FindNext(After:¬tiveCell)
If found.Address = FirstAddress Then Exit Do
Loop
End If

Next
End Sub

Saluts.

"claudy" wrote in message
news:41659220$0$11694$
Bonsoir à tous....
j'ai trouvé ceci-dessous qui marche tres bien..
merci à Stéphane Royer, mpfe.
Mais cette merveilleuse macro commence en haut de feuille!
Comment l'appliquer en commençant par les lignes les plus récentes...
c'est à dire en commencant par la Range("a64000").End(xlUp)(2).Select

Sub WorkbookFind()
'Stéphane Royer, mpfe
What = InputBox("Rechercher :")
'If What = "" Then Exit Sub
' For Each sht In Worksheets
'sht.Activate
Set Found = Cells.Find(What)
If Not Found Is Nothing Then
FirstAddress = Found.Address
Do
Found.Activate
Response = MsgBox("Continuer ?", vbYesNo + vbQuestion)
If Response = vbNo Then Exit Sub
Set Found = Cells.FindNext(After:¬tiveCell)
If Found.Address = FirstAddress Then Exit Do
Loop
End If
'Next sht
MsgBox "Recherche terminée !"
End Sub

A+
Merci
--
////
( O O )
------oOOo-(_)-oOOo-----------------
Claudy

--------------Oooo------------------
oooO ( )
( ) ) /
( (_/
_)