0

所以正如标题所说,我正在尝试搜索 Col C,如果找到文本/数字,则将文本从另一个单元格移动到 Col D

所以说得更简单

EG:C10 中有一些文本 - 所以我想将文本从 I8 复制到 D10(新数据总是向上两行和 Col I)

我一直在玩这个 VBA 代码

Dim find As String
Dim findcell As Range

FindString = "*" 
'Not sure how to find anything - But if I put a string that actually is in the sheet then it moves the example same one to Col D

For Each findcell In Range(ActiveSheet.Range("C1"), ActiveSheet.Range("C250").End(xlUp)).Cells
    If InStr(findcell, FindString) > 0 Then findcell.Offset(, 1) = FindString
Next findcell

任何帮助/建议将不胜感激

4

1 回答 1

0

尝试这个:

Dim findcell As Range

For Each findcell In Range(ActiveSheet.Range("C3"), ActiveSheet.Range("C250").End(xlUp)).Cells
    If Len(findcell) > 0 Then findcell.Offset(0, 1) = findcell.Offset(-2, 6)
Next findcell

但当然,这只会从第 3 行开始起作用,因为你说新数据总是向上两行。

于 2013-10-01T10:27:10.400 回答