我有Excel表格。第一张是关键词,第二张是原始文字。关键字文本为6,000,原始文本为3,00,000。当我编写VBA函数时,此函数不起作用。当我写出正确的公式时,它是正常的。但很少有关键字是大写的。
原文:
Bmw 325 / 328 Series / M3 L6 2.5/3.2L P/A M/T radiator
Nissan Maxima Radiator & condenser Cooling Fan assembly Tyc
Gmc, Chevy Truck Tail Light W/Connector plate Passenger Side
关键字文字:
BMW
Radiator
Assembly
GMC
Plate
condenser
我需要结果输出:
**BMW** 325 / 328 Series / M3 L6 2.5/3.2L P/A M/T **Radiator**
Nissan Maxima Radiator & **Condenser** Cooling Fan **Assembly** Tyc
**GMC**, Chevy Truck Tail Light W/Connector **Plate** Passenger Side
我不明白如何解决这类问题。我需要快速解决。
答案 0 :(得分:0)
试试这个:
Sub ReplaceWords()
Dim myarray As Variant
myarray = Array("BMW", "Radiator", "Assembly", "GMC", "Plate", "Condenser")
Dim r As Range
Set r = Range("A1")
For Each element In myarray
r.Replace What:=element, Replacement:="**" & element & "**", MatchCase:=False
Next
End Sub