我想找到并替换excel中的大量单词;如果我有一组单词,我想在Sheet1,ColumnA中查找/搜索,然后如果是Sheet2,则ColumnA反映了要查找的内容,ColumnB包含要替换找到的单词(所有逗号)我是如何做到这一点,以便替换最终回到Sheet1 ColumnA?
我怀疑这需要一个宏,我不是很熟悉。
非常感谢您的时间和帮助!
答案 0 :(得分:0)
它不是超级高效但它会完成工作。您必须考虑两个列表的长度以及更改工作表名称。
Public Sub findsometext()
For i = 1 To 10
' change 10 to however many items are in your replacement list
' start at 2 if your data has headers
Worksheets("Sheet2").Activate
target = Cells(i, 1)
replacer = Cells(i, 2)
Worksheets("Sheet1").Activate
For j = 1 To 10
' change 10 to however many items are in your data list to be processed
' start at 2 if your data has headers
Cells(j, 1) = Replace(Cells(j, 1), target, replacer)
Next j
Next i
End Sub