我正在使用下面的代碼在excel列中找到一個短語「Phase End」,其中數據存在於1到9個階段。問題是我可以通過其「階段1」「階段2」找到階段1到階段9 ......但是所有階段都具有相同的結束階段,如「階段結束」。當我執行搜索時,是否可以跳過已確定的階段並僅繼續搜索excel列的其餘部分?例如,在確定「階段3」及其「階段結束」後,我想繼續搜索階段3以下的值,但不是在階段3之前。在excel列中繼續文本搜索
Workbooks(OpenWB).Worksheets("Home").Range("B36") = Cells.Find(What:="Phase 1", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Offset(0, -1).Value
Workbooks(OpenWB).Worksheets("Home").Range("C36") = Cells.Find(What:="End Phase", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Offset(0, -1).Value
Workbooks(OpenWB).Worksheets("Home").Range("B37") = Cells.Find(What:="phase 2", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Offset(0, -1).Value
Workbooks(OpenWB).Worksheets("Home").Range("C37") = Cells.Find(What:="end phase", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Offset(0, -1).Value
Workbooks(OpenWB).Worksheets("Home").Range("B38") = Cells.Find(What:="phase 3", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Offset(0, -1).Value
Workbooks(OpenWB).Worksheets("Home").Range("C38") = Cells.Find(What:="end phase", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Offset(0, -1).Value
從本質上講,我要尋找一個更好的搜索單元以同時識別階段1和階段結束。 – santu