Sub CelluleSuivante()
Recherche xlNext
End Sub
Sub CellulePrecedente()
Recherche xlPrevious
End Sub
Sub Recherche(sens)
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
If IsError(ActiveCell) Then MsgBox "Recherche impossible...": Exit Sub
If ActiveCell = "" Then Exit Sub
Static memcel As Range 'mémorisation
Dim cel As Range, r As Range, i As Integer
Set memcel = IIf(ActiveSheet.CodeName <> "Feuil1", memcel, Nothing)
If memcel Is Nothing Then Set memcel = ActiveCell
If ActiveCell.Find(memcel, , xlFormulas, xlWhole) Is Nothing _
Then Set memcel = ActiveCell
Set cel = ActiveSheet.Cells.Find(memcel, SearchDirection:=xlPrevious)
If sens = xlNext Then Set cel = ActiveSheet.Cells.Find(memcel, cel)
Set r = ActiveSheet.Cells.Find(memcel, ActiveCell, , , , sens)
If r.Address <> cel.Address Then
r.Select
Else
i = IIf(sens = xlNext, 1, -1)
For i = ActiveSheet.Index + i To IIf(i = 1, Worksheets.Count, 1) Step i
Set cel = Worksheets(i).Cells.Find(memcel, SearchDirection:=xlPrevious)
If Not cel Is Nothing Then
If sens = xlNext Then Set cel = Worksheets(i).Cells.Find(memcel, cel)
Worksheets(i).Visible = True
Application.Goto cel
Exit Sub
End If
Next
MsgBox "Pas de cellule " & IIf(i, "suivante...", "précédente...")
End If
End Sub