删除整个列中的部分字符串

时间:2015-08-02 20:43:27

标签: vba excel-vba excel

我在A栏上有这些数据:

/importantThing1/importantThing2/
/unimportantThing/importantThing1/importantThing2
/unimportantThing/importantThing/importantThing2
/importantThing1/importantThing4/importantThing5

我希望它看起来像这样:

/importantThing1/importantThing2/
/importantThing1/importantThing2
/importantThing/importantThing2
/importantThing1/importantThing4/importantThing5

"unimportantThing"始终相同。 我尝试了一些公式,但它们没有工作,因为并非所有单元格都包含"unimportantThing"。我想用VBA做到这一点。请帮忙!

1 个答案:

答案 0 :(得分:0)

只需使用Replace函数将"/unimportantThing"替换为空字符串(""):

Columns("A:A").Replace "/unimportantThing", ""
相关问题