Private Sub CommandButton1_Click()
'=================================
'英文を分解して、シートに表示
'=================================
Dim myString As String
Dim i As Long
Dim myRow As Long
'前回のデータを削除
Cells.Select
Selection.ClearContents
'文字列をととのえる
myString = StrConv(TextBox1.Text, vbNarrow) '全角文字を半角にする
myString = Trim(myString) ' trim
myString = Replace(myString, vbCrLf, " ") '
myString = Replace(myString, ",", "") ' 指定文字を空白にする
myString = Replace(myString, ".", "") ' 指定文字を空白にする
myString = Replace(myString, "?", "") ' 指定文字を空白にする
myString = Replace(myString, "!", "") ' 指定文字を空白にする
myString = Replace(myString, ":", "") ' 指定文字を空白にする
myString = Replace(myString, "(", "") ' 指定文字を空白にする
myString = Replace(myString, ")", "") ' 指定文字を空白にする
myString = Replace(myString, """", "") ' 指定文字を空白にする
i = 0
myRow = 1
Do Until InStr(1, myString, " ", 1) = 0 '半角空白を分解
DoEvents
Cells(myRow, "A") = Trim(Left(myString, InStr(myString, " ")))
myString = Trim(Mid(myString, InStr(1, myString, " ", 1)))
myRow = myRow + 1
i = i + 1
Loop
If InStr(1, myString, " ", 1) = 0 Then
Cells(myRow, "A") = myString
myString = ""
End If
Cells(1, "A").Select
End Sub
|