剪切并复制特定的string值到相邻的单元格

我在同一个单元格中有一个公司名称和城市名称的Excel数据库,我想将城市名称拆分到find文本的相邻单元格。 我有一个数组的城市名称。

数据库看起来像:

FINER附近EL CAJON
第一个selectpipe道系统RAMONA
FRANK GILILLAND施工SANTA YNEZ
等等

我的代码到目前为止(非常基本):

Sub FindCityNames() Dim citylist(500) As String Dim i, j, k As Integer For j = 1 To 500 citylist(j) = Workbooks("cities.xlsm").Worksheets("City list").Cells(j, 1) Next j For i = 1 To 500 Cells.Find(What:=citylist(i), After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveRange.Cut Next i End Sub 

哪个应该做的findstring和切割它的工作,但我不知道如何参考它被发现的行中select粘贴区域。

有什么想法吗?

最后,我设法通过使用string来解决问题:感谢ASH的帮助!

 Sub FindCityNames() Dim citylist(20000) As String Dim i, j, k, l As Integer Dim city, company As String For j = 1 To 20000 citylist(j) = Workbooks("adatformazas2.xlsm").Worksheets("City list").Cells(j, 1) Next j For j = 1 To 20000 city = UCase(citylist(j)) l = Len(city) If l > 0 Then With ActiveSheet '.Cells(1, 8) = city For i = 1 To .UsedRange.Rows.Count company = RTrim(.Cells(i, 1)) R = Right(company, l) If R = city Then If .Cells(i, 2).Value = "" Then .Cells(i, 1) = RTrim(Left(company, Len(company) - l)) .Cells(i, 2) = city End If End If Next i End With End If Next j End Sub