我似乎无法弄清楚如何把这一切都放到正则表达式中。我知道必须有一个简单的方法,但我很难过。我不认为你可以用vba excel进行链接?任何指导都会很棒。谢谢!
设置Myrange = ActiveSheet.Range(范围(“A2”),范围(“A2”)。结束(xlDown))
For Each Cell In Myrange
strInput = LCase(Cell.value)
strInput = Replace(strInput, " ", "-")
strInput = Replace(strInput, ".", "-")
strInput = Replace(strInput, ",", "-")
strInput = Replace(strInput, "'", "")
strInput = Replace(strInput, ")", "")
strInput = Replace(strInput, "(", "")
strInput = Replace(strInput, "---", "-")
strInput = Replace(strInput, "--", "-")
strInput = Replace(strInput, "®", "")
strInput = Replace(strInput, "™", "")
strInput = Replace(strInput, "%", "-percent")
strInput = Replace(strInput, """", "-inch")
Cells(Cell.Row, "F") = strInput
Next
答案 0 :(得分:0)
根据您提供的信息,您需要4个正则表达式 有关如何在VBA中运行正则表达式的信息,请参阅this post
<强>正则表达式强>
([ .,]|-{2,3})
<强>替换强>
-
<强>正则表达式强>
(['()]|®|™)
<强>替换强>
<强>正则表达式强>
(%)
<强>替换强>
-percent
<强>正则表达式强>
(")
<强>替换强>
-inch