標準モジュールにユーザー定義関数を作る
'使い方:=toNarrow(A1)
Public Function toNarrow(str As String) As String
Const AlphaNum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
Const AlphaNumW = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
Dim i As Integer
Dim length As Integer
Dim c As String
Dim x As Integer
length = Len(str)
For i = 1 To length
c = Mid(str, i, 1)
x = InStr(AlphaNumW, c)
If x > 0 Then
Mid(str, i, 1) = Mid(AlphaNum, x, 1)
End If
Next
toNarrow = str
End Function
お礼
ありがとうございます!!! 大変助かりました!!