Excel VBA-删除字符串的一部分 [英] Excel VBA- remove part of the string

查看:1151
本文介绍了Excel VBA-删除字符串的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试删除部分字符串.例如
mystring="site, site text, sales "

I am trying to delete part of the string. For example
mystring="site, site text, sales "

我想从mystring中删除"网站".我需要的输出是网站文字,销售"

I want to remove 'site' from mystring. My required output is "site text, sales"

我使用这一行代码:

s1 = Replace(mystring, "site", "")

但是我正在得到"text, sales"

我不确定该怎么做,非常感谢您的帮助!

I am not sure how to do this and I'd really appreciate your help!

推荐答案

replace("site, site text, sales ","site, ","",1,1)

您还可以发送起始位置,然后发送要替换的次数作为参数...(默认值为-1)

You can also send as a parameter the start position and then the number of times you want to replace... (the default is -1)

这篇关于Excel VBA-删除字符串的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆