|
ほびっと さん
まじめに動作確認をしていませんが。
選択範囲内のsetStrに格納した文字列を、
reStrの文字と置き換えます。
Sub 小文字置換()
Dim myRE As Object
Dim setStr As Variant, reStr As Variant
Dim mySel As Range, myCell As Range
Dim i As Integer
Set myRE = CreateObject("VBScript.RegExp")
setStr = Array("ぁ", "ぃ", "ぅ", "ぇ", "ぉ", "っ", "ゃ", "ゅ", "ょ")
reStr = Array("あ", "い", "う", "え", "お", "つ", "や", "ゆ", "よ")
myRE.Global = True
Set mySel = Selection
For Each myCell In mySel
For i = LBound(setStr) To UBound(setStr)
myRE.Pattern = setStr(i)
myCell.Value = myRE.Replace(myCell.Value, reStr(i))
Next i
Next myCell
End Sub
|
|