5:全角英数字を半角にするコード
▼ 前半で紹介したコードの完全版です。使用手順は【1】~【8】と同じです。
■ このコードで修正できること
----------------------------------------
1. 全角数字0~9を半角にする
2. 全角のa~zを半角にする
3. 全角のA~Zを半角にする
----------------------------------------
With Selection.Find
.Text = "1"
.Replacement.Text = "1"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "2"
.Replacement.Text = "2"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "3"
.Replacement.Text = "3"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "4"
.Replacement.Text = "4"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "5"
.Replacement.Text = "5"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "6"
.Replacement.Text = "6"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "7"
.Replacement.Text = "7"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "8"
.Replacement.Text = "8"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "9"
.Replacement.Text = "9"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "0"
.Replacement.Text = "0"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "a"
.Replacement.Text = "a"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "b"
.Replacement.Text = "b"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "c"
.Replacement.Text = "c"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "d"
.Replacement.Text = "d"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "e"
.Replacement.Text = "e"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "f"
.Replacement.Text = "f"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "g"
.Replacement.Text = "g"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "h"
.Replacement.Text = "h"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "i"
.Replacement.Text = "i"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "j"
.Replacement.Text = "j"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "k"
.Replacement.Text = "k"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "l"
.Replacement.Text = "l"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "m"
.Replacement.Text = "m"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n"
.Replacement.Text = "n"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "o"
.Replacement.Text = "o"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "p"
.Replacement.Text = "p"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "q"
.Replacement.Text = "q"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r"
.Replacement.Text = "r"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "s"
.Replacement.Text = "s"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "t"
.Replacement.Text = "t"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "u"
.Replacement.Text = "u"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v"
.Replacement.Text = "v"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "w"
.Replacement.Text = "w"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "x"
.Replacement.Text = "x"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "y"
.Replacement.Text = "y"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "z"
.Replacement.Text = "z"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "A"
.Replacement.Text = "A"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "B"
.Replacement.Text = "B"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "C"
.Replacement.Text = "C"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "D"
.Replacement.Text = "D"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "E"
.Replacement.Text = "E"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "F"
.Replacement.Text = "F"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "G"
.Replacement.Text = "G"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "H"
.Replacement.Text = "H"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "I"
.Replacement.Text = "I"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "J"
.Replacement.Text = "J"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "K"
.Replacement.Text = "K"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "L"
.Replacement.Text = "L"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "M"
.Replacement.Text = "M"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "N"
.Replacement.Text = "N"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "O"
.Replacement.Text = "O"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "P"
.Replacement.Text = "P"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Q"
.Replacement.Text = "Q"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "R"
.Replacement.Text = "R"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "S"
.Replacement.Text = "S"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "T"
.Replacement.Text = "T"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "U"
.Replacement.Text = "U"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "V"
.Replacement.Text = "V"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "W"
.Replacement.Text = "W"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "X"
.Replacement.Text = "X"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Y"
.Replacement.Text = "Y"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Z"
.Replacement.Text = "Z"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
1 2