Parsing Data
TextToColumns might be easier to use, but this will do what you asked using
the Parse method (where I commented in the assumed For-Next loop I assume
you are using)...
Dim X As Long
Dim iR As Long
Dim Pattern As String
Dim Words() As String
'For iR = <StartRow to <EndRow
Words = Split(Cells(iR, 1).Value)
Pattern = "["
For X = 0 To UBound(Words)
Pattern = Pattern & Space(Len(Words(X))) & "]"
If X < UBound(Words) Then Pattern = Pattern & " ["
Next
Cells(iR, 1).Parse Destination:=Cells(iR, 2), ParseLine:=Pattern
'Next
--
Rick (MVP - Excel)
"pdberger" wrote in message
...
Good morning --
I'm trying to parse this:
A B C D
Alfred E Newman
into:
A B C D
Alfred E Newman
What I've written is:
Cells(iR, 1).Parse Destination:=Cells(iR, 2)
but it just copies the entire cell contents to the next row over. What am
I
doing wrong?
TIA
|