编辑:使用按钮替换字符串vba
我更关注PHP,我刚开始学习VBA。 这是我为按钮制作的代码。
Private Sub btnConvert_Click()
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim f As String
a = "a"
b = "b"
c = "c"
d = "d"
e = "e"
f = "f"
Columns("B").Replace what:=a, replacement:=b, lookat:=xlPart, MatchCase:=False
Columns("B").Replace what:=c, replacement:=d, lookat:=xlPart, MatchCase:=False
Columns("B").Replace what:=e, replacement:=f, lookat:=xlPart, MatchCase:=False
End Sub
现在,我的问题是:在 代码就像上面,它发生的“B”将与“一”来代替。 但现在我也想删除一部分字符串。
例如字符串是:
a(hey)/(qworty);
c(yow)/(asdf);
e(wow)/(zxcv_786);
当我点击按钮上的文本应该被替换为:
b(hey);
c(yow);
e(wow);
希望你明白。 谢谢。
'列( “B”)更换什么:= “/(qworty)”,替换:= “”,LOOKAT:= xlPart,MatchCase:= FALSE' –
我改变这些实施例。抱歉。 – akamariaclaraaa