- Sub SplitSpaceLetter()
- Dim i As Byte
- Dim MyTempStr As String
- Dim MyCol As Byte, MyPosCur As Byte, MyPosOld As Byte
-
- Range(Cells(2, 2), Cells(5, 10)).ClearContents
-
- For i = 2 To 5
- MyTempStr = Range("A" & i).Value
- MyCol = 2
- MyPosCur = 1
- MyPosOld = 1
-
- Do While MyPosCur <= Len(MyTempStr)
- If Mid(MyTempStr, MyPosCur, 1) = " " Then
- If UCase(Mid(MyTempStr, MyPosCur + 1, 1)) Like "[А-Я]" Then
-
-
-
- Cells(i, MyCol).Value = Mid(MyTempStr, MyPosOld, MyPosCur - MyPosOld)
-
-
-
- MyCol = MyCol + 1
- MyPosOld = MyPosCur + 1
- End If
- End If
- MyPosCur = MyPosCur + 1
- Loop
-
-
-
- Cells(i, MyCol).Value = Mid(MyTempStr, MyPosOld, MyPosCur - MyPosOld)
- Next i
- End Sub
Ответить
|