VBA-Programmierung in Microsoft Excel

Tutorial: Excel-Beispiele

VBA-Begriff: Beispiel zur FindPrevious-Methode

In diesem Beispiel wird gezeigt, wie die FindPrevious-Methode mit der Find- und FindNext-Methode zusammenarbeitet. Stellen Sie sicher, dass der Begriff "Phoenix" mindestens zweimal in Spalte B in Sheet1 vorkommt, bevor Sie dieses Beispiel ausführen.

Set fc = Worksheets("Sheet1").Columns("B").Find(what:="Phoenix")
    MsgBox "The first occurrence is in cell " & fc.Address
Set fc = Worksheets("Sheet1").Columns("B").FindNext(after:=fc)
    MsgBox "The next occurrence is in cell " & fc.Address
Set fc = Worksheets("Sheet1").Columns("B").FindPrevious(after:=fc)
    MsgBox "The previous occurrence is in cell " & fc.Address