|
ダブルクォーテーションをシングルクォーテーションに変更したい
変換前は半角ダブルで
返還後は全角シングルへ
Sub 置換()
Dim mystr(1, 32) As String
mystr(0, 0) = "MI"
mystr(1, 0) = "M I"
mystr(0, 1) = "NI"
mystr(1, 1) = "N I"
mystr(0, 2) = "GA"
mystr(1, 2) = "G A"
mystr(0, 3) = "SI"
mystr(1, 3) = "S I"
mystr(0, 4) = "RI"
mystr(1, 4) = "R I"
mystr(0, 5) = ":〜"
mystr(1, 5) = ": 〜"
mystr(0, 6) = "OW"
mystr(1, 6) = "O W"
mystr(0, 7) = "7WV"
mystr(1, 7) = "7 WV"
mystr(0, 8) = "1WV"
mystr(1, 8) = "1 WV"
mystr(0, 9) = ".."
mystr(1, 9) = "."
mystr(0, 10) = "H."
mystr(1, 10) = "H ."
mystr(0, 11) = "N."
mystr(1, 11) = "N ."
mystr(0, 12) = "M."
mystr(1, 12) = "M ."
mystr(0, 13) = "G."
mystr(1, 13) = "G ."
mystr(0, 14) = "'"
mystr(1, 14) = "’"
mystr(0, 15) = "HW"
mystr(1, 15) = "H W"
mystr(0, 16) = "TK."
mystr(1, 16) = "TK ."
mystr(0, 17) = "L."
mystr(1, 17) = "L ."
mystr(0, 18) = "UD"
mystr(1, 18) = "U D"
mystr(0, 19) = "UM"
mystr(1, 19) = "U M"
mystr(0, 20) = "MA"
mystr(1, 20) = "M A"
mystr(0, 21) = "ND"
mystr(1, 21) = "N D"
mystr(0, 22) = "HA"
mystr(1, 22) = "H A"
mystr(0, 23) = "AM"
mystr(1, 23) = "A M"
mystr(0, 24) = "RA"
mystr(1, 24) = "R A"
mystr(0, 25) = "G/"
mystr(1, 25) = "G /"
mystr(0, 26) = "M/"
mystr(1, 26) = "M /"
mystr(0, 27) = "HU"
mystr(1, 27) = "H U"
mystr(0, 28) = "(P"
mystr(1, 28) = "( P"
mystr(0, 29) = "E ."
mystr(1, 29) = "E."
mystr(0, 30) = "SC"
mystr(1, 30) = "S C"
mystr(0, 31) = "CLR ."
mystr(1, 31) = "CLR."
mystr(0, 32) = """"
mystr(1, 32) = "’’"
Call 配列置換(mystr)
End Sub
=====================================
Sub 配列置換(ByRef mystr() As String) '配列置換
Dim i As Long
Dim jj
' On Error GoTo logout
Application.ScreenUpdating = False
With chhani
'Debug.Print "置換" & ActiveWorkbook.name, ActiveSheet.name
For i = 0 To UBound(mystr, 2)
.NumberFormatLocal = "@"
.Cells = Application.Substitute(.Cells, mystr(0, i), mystr(1, i))
Next i
End With
For Each jj In chhani
jj.Value = RTrim$(jj.Value)
jj.Value = LTrim$(jj.Value)
Next jj
End Sub
いろんなコードとくっついているので、これくらいで。
Set chhani = .UsedRange
chhaniはシート全面にかかると思って下さい。
****ここの部分がうまく反映されないです。セルの先頭に来るときに。
mystr(0, 32) = """"
mystr(1, 32) = "’’"
わかりにくくてすみません。
|
|