目前我有一个宏,它在另一个文档中查找并在存在值时复制一个偏移单元格。我已经有下面的代码(只有选择/复制偏移单元格的部分),但它只会复制一行。这对于我正在搜索的大多数项目都很好。有谁知道如何修改下面的代码以复制包含我搜索值的所有单元格?
For I = LBound(MyArr) To UBound(MyArr)
Set Rng = .Find(What:=MyArr(I), _
After:=.Cells(.Cells.Count), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
FirstAddress = Rng.Address
Do
'mark the cell in the column to the right if "Ron" is found
Rng.Offset(0, 4).Select
'Rng.Copy "A" & Rcount
Set Rng = .FindNext(Rng)
Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
Selection.Copy (Rng)
End If
Next I
End With