標題:
[發問]
多目標Replace怎麼寫最精簡?
[打印本頁]
作者:
VBALearner
時間:
2017-7-23 00:31
標題:
多目標Replace怎麼寫最精簡?
各位高手
如果我想寫對A1:B10範圍的儲存格做多目標Replace,把 "、" , "。" , "," , "!" , "?"都去掉,類似Replace(array("、" , "。" , "," , "!" , "?") , "")的動作,該怎麼寫會最精簡?
謝謝回覆
作者:
GBKEE
時間:
2017-7-24 09:07
回復
1#
VBALearner
試試看
Option Explicit
Sub Ex()
Dim AR(), St As String, e As Variant
AR = Array("、", "。", ",", "!", "?")
St = "ABCD、。eFg,!Hijk?"
For Each e In AR
St = Replace(St, e, "")
Next
MsgBox St
End Sub
複製代碼
作者:
VBALearner
時間:
2017-7-24 21:02
回復
2#
GBKEE
感謝版大回覆~
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)