|
Option Explicit
Sub mojimojikun()
Dim myAry1, myAry2
Dim lstr As String
Dim myRng As Range
Dim n As Long, i As Long, j As Long
myAry1 = Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", _
"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", _
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
myAry2 = Array("ア", "イ", "ウ", "エ", "オ", "カ", "キ", "ク", "ケ", "コ", "サ", "シ", "ス", "セ", "ソ", _
"タ", "チ", "ツ", "テ", "ト", "ナ", "ニ", "ヌ", "ネ", "ノ", "ハ", "ヒ", "フ", "ヘ", "ホ", _
"マ", "ミ", "ム", "メ", "モ", "ラ", "リ", "ル", "レ", "ロ", "ヤ", "ユ", "ヨ", "ヲ", "ン")
For Each myRng In Selection
n = Len(myRng)
For i = 1 To n
For j = 0 To UBound(myAry1)
lstr = Right(Left(myRng, i), 1)
If lstr = myAry1(j) Then
myRng.Offset(, 1) = myRng.Offset(, 1) & StrConv(lstr, vbUpperCase)
ElseIf lstr = myAry2(j) Then
myRng.Offset(, 1) = myRng.Offset(, 1) & StrConv(lstr, vbWide)
End If
Next
Next
Next
End Sub
|
|