希望这会有所帮助,可能已经过火了
Sub Solution()
Dim search As String, start As Integer, lastaddress As String, toworksheet As String
lastaddress = "A2" 'cell location on the result sheet
search = InputBox("Enter Search Critera") 'enter search critera
start = InputBox("Start from") 'integer of where to search in the string, not zero index
toworksheet = InputBox("Put results into which spreadsheet") 'worksheet name to put results
'select the cell you want to start your search from and it will continue till it reaches a blank cell
Do While ActiveCell.Text <> ""
'Performs the test
If Mid(ActiveCell.Text, start, Len(search)) = search Then
'adds the entry to the results sheet
Worksheets(toworksheet).Cells.Range(lastaddress).Value = ActiveCell.Text
'updates the address to the next line in your results sheet
lastaddress = Worksheets(toworksheet).Cells.Range(lastaddress).Offset(1, 0).Address
End If
'goes to next item in list
ActiveCell.Offset(1, 0).Select
Loop
End Sub