Ecco il foglio con un ipotetico numero di protocollo sulla colonna A:
Ed ecco il codice:
Sub main() Dim indirizzo As String Dim numero As Long Set c = Cells.Find("antonio cacchioni") If c Is Nothing = False Then indirizzo = c.Address Do Set c = Cells.FindNext(c) If Cells(c.Row, c.Column + 1).Formula = "56" And Cells(c.Row, c.Column - 1).Formula > numero _ Then numero = Cells(c.Row, c.Column - 1).Formula Loop While c.Address <> indirizzo End If MsgBox numero End SubRisultato:
Okay! Funziona!
Nessun commento:
Posta un commento