Discofly

EXCEL VBA についての備忘録

セルから半角英数だけを抽出する方法

ユーザー定義関数を作る

Function 英数(r As Range) As String
Dim i As Long
For i = 1 To Len(r.Value)
If Mid(r.Value, i, 1) Like "[0-9,A-z,+,-]" Then 英数 = 英数 & Mid(r.Value, i, 1) Next i
End Function

=英数(A1) 

とすると半角英数だけ抽出できる。

 

ユーザー定義関数の作り方はwebで調べること

 

引用元

エクセルのセル内の英数字のみを抽出したいのですが教えてください。 -... - Yahoo!知恵袋